0

last week I published a really simple package on NPM. It only comprises three files:

package.json  README.md  tofjs-full.node.js

The tofjs-full.node.js contains the whole code, the package is called tofjs-full and it should be available after a require('tofjs-full') call.

The package.json file has the following content:

{ "name": "tofjs-full",
  "version": "1.0.0",
  "description": "`tofjs-full` is the current state of the [TofJs](http://tofjs.org) program, bundled in a single NPM package.",
  "author": "bucephalus <bucephalus.org@gmail.com> (http://bucephalus.org)",
  "license": "ISC",
  "homepage": "http://tofjs.org/program/tofjs-full",
  "bugs": { "url": "https://groups.google.com/forum/#!forum/tofjs" },
  "repository": "http://tofjs.org/package/tofjs-full/1.0.0/",
  "main": "tofjs-full.node.js",
  "dependencies": {
    "fs-extra": "^0.30.0",
    "markdown": "^0.5.0",
    "sha1": "^1.1.1",
    "sha1-file": "^1.0.0",
    "coffee-script": "^1.10.0",
    "escodegen": "^1.8.0",
    "esprima": "^2.7.2"
  },
  "files": [ "tofjs-full.node.js" ] }

I published the package by going to the according directory and call

npm publish

I don't remember the precise reaction. But the package tofjs-full is now officially available from the NPM repository (https://www.npmjs.com/package/tofjs-full).

However, when I go to another machine and try a sudo npm install tofjs-full the answer is a display with the tree of all dependencies and then some warnings (each line beginning with npm WARN):

ENOENT: no such file or directory, open `'/path/to/dir/package.json'
No description field.
No README data.
No license field.

Can you tell me what's going wrong, please? Thank you, Bucephalus

baao
  • 71,625
  • 17
  • 143
  • 203
  • ... sorry, I meant to say "The package `tofjs-full` is now officially available from the NPM repository." instead of "... not officially available ...". – user2527816 Jan 17 '17 at 19:29

2 Answers2

1

It is just a warning as it can't find the package.json for your project, since I assume like me you just went into a directory and ran npm install tofjs-full. It can be safely ignored.

npm install tofjs-full
- rxjs@5.0.0-beta.6 node_modules/node_modules/node_modules/rxjs
- zone.js@0.6.12 node_modules/node_modules/node_modules/zone.js
/path/dir
├── UNMET PEER DEPENDENCY @angular/core@2.0.0-rc.3
└─┬ tofjs-full@1.0.0
  ├── coffee-script@1.12.2
  ├─┬ escodegen@1.8.1
  │ ├── estraverse@1.9.3
  │ ├── esutils@2.0.2
  │ ├─┬ optionator@0.8.2
  │ │ ├── deep-is@0.1.3
  │ │ ├── fast-levenshtein@2.0.6
  │ │ ├── levn@0.3.0
  │ │ ├── prelude-ls@1.1.2
  │ │ ├── type-check@0.3.2
  │ │ └── wordwrap@1.0.0
  │ └─┬ source-map@0.2.0
  │   └── amdefine@1.0.1
  ├── esprima@2.7.3
  ├─┬ fs-extra@0.30.0
  │ ├── graceful-fs@4.1.11
  │ ├── jsonfile@2.4.0
  │ ├── klaw@1.3.1
  │ ├── path-is-absolute@1.0.1
  │ └─┬ rimraf@2.5.4
  │   └─┬ glob@7.1.1
  │     ├── fs.realpath@1.0.0
  │     ├─┬ inflight@1.0.6
  │     │ └── wrappy@1.0.2
  │     ├── inherits@2.0.3
  │     ├─┬ minimatch@3.0.3
  │     │ └─┬ brace-expansion@1.1.6
  │     │   ├── balanced-match@0.4.2
  │     │   └── concat-map@0.0.1
  │     └── once@1.4.0
  ├─┬ markdown@0.5.0
  │ └─┬ nopt@2.1.2
  │   └── abbrev@1.0.9
  ├─┬ sha1@1.1.1
  │ ├── charenc@0.0.2
  │ └── crypt@0.0.2
  └── sha1-file@1.0.0

npm WARN enoent ENOENT: no such file or directory, open '/path/dir/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/path/dir/node_modules/node_modules/package.json'
npm WARN @angular/common@2.0.0-rc.3 requires a peer of @angular/core@2.0.0-rc.3 but none was installed.
npm WARN xxxx No description
npm WARN xxxx No repository field.
npm WARN xxxx No README data
npm WARN xxxx No license field.

You should find that the library was installed at /path/dir/node_modules/tofjs-full

Kody
  • 1,319
  • 1
  • 9
  • 12
  • Ahhh, you are great! Thank you very much for your response, I am very grateful. But the problem is, that the package does not install. It does show after a `npm ls`, indeed. But when I run a `node` session and call `require('tofjs-full')`, it says `Error: cannot find module 'tofjs-full'. – user2527816 Jan 17 '17 at 19:45
  • @user2527816 looking at the contents of your package I only see the following `README.md & package.json`. It seems when you did the npm publish that was not done correctly or with the correct files and or configuration. – Kody Jan 17 '17 at 19:49
  • @user2527816 I think it might have to do with your `"repository": "http://tofjs.org/package/tofjs-full/1.0.0/"` configuration. It seems that is not a valid repository. – Kody Jan 17 '17 at 19:52
  • Hi Kody, thank's a lot!! Yes, indeed, when I look into the tree of my re-installation, I also see two files, only: `package.json` and `README.md`. The `tofjs-full.node.js` is missing, indeed. Maybe, that is due to the fact, that in the directory, where I published from, this file name was only a soft link to the file `tofjs-full.node.js` at some place else. This would be a strange behavior. But it would explain the failure to me. Maybe, I should try a second patch installation with the original file. – user2527816 Jan 17 '17 at 20:02
  • @user2527816 Yeah a symlink would likely cause the issue. Hopefully this answer helped get you to the solution you were looking for! – Kody Jan 17 '17 at 20:03
  • Hi Kody, thank you, once again! Yes, the repository does not seem to be valid, and I somehow knew that. But this should not cause the problems as they appeared, right? The repository is not an essential information for the installation process, or is it? – user2527816 Jan 17 '17 at 20:04
  • @user2527816 It is useful as it is linked to on the sidebar of https://www.npmjs.com/package/tofjs-full - Having a correct repository link will help others see the code and possibly contribute! – Kody Jan 17 '17 at 20:07
  • Yes, Kody, I will try an update without a soft link next. Even if that might not bring the solution, you nice guys out there gave me hope again with this whole project. I tried the official NPM support last Friday, but I waited five days in vain. ... Anyway, thank you very very much. I really owe you!! :-) – user2527816 Jan 17 '17 at 20:11
  • @user2527816 No problem! Hopefully this solved the problem, if so make sure you mark the correct answer here so that others coming to this thread can identify a solution quickly! – Kody Jan 17 '17 at 20:14
0

I published a package with three files, but one of the files was a soft link to the original file. It seems, that npm publish ignores soft links, because a subsequent npm install did not know about the file. I solved the problem by another patch, where I replaced the soft link by a proper file. Thank you Kody and baao, you really made my day by helping me! :-)