【问题标题】:npm install not reading package.jsonnpm install 不读取 package.json
【发布时间】:2016-05-05 16:58:00
【问题描述】:

不知道发生了什么,但我有一个通过数字海洋在 ubuntu 上运行的盒子,并且刚刚克隆了我的 git repo。我有一个格式正确的 package.json(我以前用过),有大约 20 个依赖项。

我克隆的当前目录有 chmod777,当我

sudo npm install

它开始安装包,但没有创建 node_modules,也没有从我的 package.json 中提取我的任何节点依赖项,并且在安装尝试结束时有一个终止日志

有什么地方可以开始调试吗?我正在运行最新的 npm 版本(3.8.8)和节点 5.8

编辑:这是 npm install 的输出

npm WARN deprecated graceful-fs@3.0.8: graceful-fs v3.0.0 and before will fail on node releases >= v6.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated graceful-fs@2.0.3: graceful-fs v3.0.0 and before will fail on node releases >= v6.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated graceful-fs@1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v6.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated lodash@0.10.0: lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^4.0.0.
npm WARN deprecated wrench@1.4.4: wrench.js is deprecated! You should check out fs-extra (https://github.com/jprichardson/node-fs-extra) for any operations you were using wrench for. Thanks for all the usage over the years.
npm WARN deprecated npmconf@2.1.2: this package has been reintegrated into npm and is now out of date with respect to npm
npm WARN deprecated graceful-fs@1.1.14: graceful-fs v3.0.0 and before will fail on node releases >= v6.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated lodash@1.0.2: lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^4.0.0.
npm WARN deprecated jade@1.11.0: Jade has been renamed to pug, please install the latest version of pug instead of jade
extract:winston → gunzTar ▄ ╢█████████████████████████████████████████████████████████████████████████████████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
Killed

这是我的 package.json

{
  "name": "app",
  "version": "1.0.0",
  "main": "server.js",
  "private": true,
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "node ./bin/www"
  },
  "dependencies": {
    "body-parser": "~1.10.2",
    "bower": "~1.4.1",
    "cheerio": "~0.20.0",
    "connect-mongo": "latest",
    "cookie-parser": "latest",
    "express": "latest",
    "express-session": "latest",
    "growl": "~1.8.1",
    "grunt": "~0.4.5",
    "grunt-bower-task": "~0.4.0",
    "grunt-contrib-concat": "~1.0.0",
    "grunt-contrib-copy": "~0.8.0",
    "grunt-contrib-jshint": "~1.0.0",
    "grunt-contrib-sass": "~1.0.0",
    "grunt-contrib-uglify": "~1.0.0",
    "grunt-contrib-watch": "~0.6.1",
    "grunt-html2js": "~0.3.2",
    "grunt-notify": "~0.4.1",
    "grunt-script-link-tags": "^1.0.2",
    "log4js": "~0.6.33",
    "method-override": "~2.0.2",
    "moment": "^2.12.0",
    "mongoose": "~4.4.7",
    "npm": "^3.8.6",
    "passport": "latest",
    "passport-openid": "latest",
    "request": "latest",
    "socket.io": "~1.4.5",
    "socket.io-client": "^1.4.5",
    "time-grunt": "~1.2.1",
    "winston": "^2.2.0"
  }
}

【问题讨论】:

  • npm install 的输出是什么?
  • 我用该信息更新了我的操作
  • 我可能内存不足... nvm 不起作用

标签: node.js git npm npm-install


【解决方案1】:

我认为是内存耗尽。您可以查看 /var/log/syslog 以了解它是否是节点。在这里找到:what can cause nodejs to print killed and exit

或尝试添加swap file

【讨论】:

  • 我需要添加一个交换文件。修复了我的问题。谢谢!
猜你喜欢
  • 2013-07-30
  • 2016-10-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-07-16
  • 2018-01-04
  • 1970-01-01
相关资源
最近更新 更多