发布npm,在其他PC上安装后报错

Publish npm, and after installation on other PC have error

然后安装到其他电脑上查看。 Bu 在安装包后依赖它,我在尝试启动它时遇到错误

pm ERR! Linux 4.10.0-38-generic
npm ERR! argv "/home/pavlo/.nvm/versions/node/v6.11.4/bin/node" "/home/pavlo/.nvm/versions/node/v6.11.4/bin/npm" "start" "storjboard"
npm ERR! node v6.11.4
npm ERR! npm  v3.10.10
npm ERR! path /home/pavlo/Desktop/test/package.json
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open

npm ERR! enoent ENOENT: no such file or directory, open '/home/pavlo/Desktop/test/package.json'
npm ERR! enoent ENOENT: no such file or directory, open '/home/pavlo/Desktop/test/package.json'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! Please include the following file with any support request:
npm ERR!     /home/pavlo/Desktop/test/npm-debug.log

问题是我必须从 git 克隆 package.json,我如何才能使用 package.json 正确发布?

注意:命令在 package.json 个脚本中启动

我的 json 发布:

{
  "name": "name",
  "version": "0.0.3",
  "description": "Name",
  "main": "script.js",
  "dependencies": {
    "request": "^2.83.0",
  },
  "devDependencies": {},
  "scripts": {
    "test": "mocha",
    "start": "node node_modules/module/script.js"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/me/module"
  },
  "keywords": [
    "somewords"
  ],
  "author": "me",
  "license": "MIT",
  "bugs": {
    "url": "https://github.com/me/module/issues"
  },
  "homepage": "https://github.com/me/module#readme"
}

在其他 PC 上安装模块时出错(警告)

npm WARN enoent ENOENT: no such file or directory, open '/home/pavlo/Desktop/test/package.json'
npm WARN test No description
npm WARN test No repository field.
npm WARN test No README data
npm WARN test No license field.

但在 test/node_modules/module/(here there are everything) 自述文件中,json 和脚本

如果你想从另一个目录启动你的模块,你可以这样做:

在你的模块中 package.json

{
  "name": "module",
  "scripts": {
    "start": "node script.js"
  }
}

来自测试目录(如 this 答案所建议):

npm start --prefix node_modules/module/

或者,您可以通过在测试目录中创建一个 package.json 文件并添加一个脚本来启动您的模块:

{
  "name": "test",
  "scripts": {
    "start": "node node_modules/module/script.js"
  }
}

通常 npm 包放在 node_modules 目录中,因为这些模块应该用作依赖项,而不是直接使用。

这取决于您的应用程序的用途,但也许您可能对执行 post 安装脚本或全局安装它感兴趣。

npm doc 用于软件包安装。