0

上周我在 NPM 上发布了一个非常简单的包。它只包含三个文件:

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

包含整个tofjs-full.node.js代码,包被调用tofjs-full,它应该在require('tofjs-full')调用后可用。

package.json文件具有以下内容:

{ "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" ] }

我通过转到相应的目录并调用来发布包

npm publish

我不记得确切的反应。但是该包tofjs-full现在可以从 NPM 存储库 ( https://www.npmjs.com/package/tofjs-full ) 正式获得。

但是,当我转到另一台机器并尝试 sudo npm install tofjs-full 时,答案是显示所有依赖项的树,然后是一些警告(每行以 开头npm WARN):

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

你能告诉我出了什么问题吗?谢谢你,布塞法洛斯

4

2 回答 2

1

这只是一个警告,因为它无法为您的项目找到 package.json,因为我假设您像我一样只是进入一个目录并运行npm install tofjs-full. 可以放心地忽略它。

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.

您应该会发现该库安装在/path/dir/node_modules/tofjs-full

于 2017-01-17T19:39:10.497 回答
0

我发布了一个包含三个文件的包,但其中一个文件是指向原始文件的软链接。似乎npm publish忽略了软链接,因为后续npm install不知道该文件。我通过另一个补丁解决了这个问题,我用适当的文件替换了软链接。谢谢 Kody 和 baao,你们帮助我真的让我很开心!:-)

于 2017-01-18T10:40:01.913 回答