Keystonejs - 使用npm安装依赖项失败

时间:2016-03-08 23:35:16

标签: node.js npm keystonejs

我现在浪费了四个小时试图在生产中安装我的'keystonejs`项目的所有依赖项。

npm只是挂起然后我收到此消息:

<--- Last few GCs --->

  859221 ms: Scavenge 116.4 (156.1) -> 115.5 (156.1) MB, 164.5 / 0 ms (+ 1116.0 ms in 14 steps since last GC) [allocation failure].
 1003590 ms: Scavenge 116.5 (156.1) -> 115.6 (156.1) MB, 15.8 / 15 ms (+ 1588.7 ms in 14 steps since last GC) [allocation failure].
 1003797 ms: Scavenge 116.5 (156.1) -> 115.6 (156.1) MB, 0.5 / 0 ms (+ 1.0 ms in 14 steps since last GC) [allocation failure].


<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0x3fb4b37e3ac1 <JS Object>
    1: baseClone(aka baseClone) [/usr/local/lib/node_modules/npm/node_modules/lodash.clonedeep/index.js:~253] [pc=0xbd65c4932f9] (this=0x3fb4b3704189 <undefined>,value=0x35b70929ee81 <an Object with map 0x16ee5e917979>,isDeep=0x3fb4b3704231 <true>,customizer=0x3fb4b3704189 <undefined>,key=0,object=0x35b70928f3d1 <JS Array[8]>,stack=0x1c3082095b39 <a Stack with map 0x3ad6ac90daa9>)
    2: /* ano...

FATAL ERROR: Committing semi space failed. Allocation failed - process out of memory

这是我的`package.json``

{
  "name": "mysite",
  "version": "0.0.0",
  "private": true,
  "dependencies": {
    "keystone": "^0.3.16",
    "async": "^1.5.0",
    "underscore": "^1.8.3",
    "node-sass": "^3.3.2",
    "node-sass-middleware": "^0.9.7", 
    "dotenv": "^1.1.0"
  },
  "devDependencies": {
    "grunt": "^0.4.4",
    "grunt-express-server": "^0.4.17",
    "grunt-contrib-watch": "^0.6.1",
    "grunt-contrib-jshint": "^0.7.1",
    "jshint-stylish": "^2.0.1",
    "load-grunt-tasks": "^0.4.0",
    "load-grunt-configs": "^0.4.1",
    "grunt-node-inspector": "^0.4.1",
    "time-grunt": "^0.3.1",
    "grunt-concurrent": "^0.5.0",
    "grunt-nodemon": "^0.2.1", 
    "grunt-sass": "^1.0.0", 
    "open": "0.0.5"
  },
  "engines": {
    "node": ">=0.10.22",
    "npm": ">=1.3.14"
  },
  "scripts": {
    "start": "node keystone.js"
  },
  "main": "keystone.js"
}

更新:我正在使用节点5.7和npm 3.6

1 个答案:

答案 0 :(得分:0)

您的服务器上需要更多内存才能获得npm。只需按照https://stackoverflow.com/a/17173973/124416

中的说明添加一些内容
sudo /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
sudo /sbin/mkswap /var/swap.1
sudo /sbin/swapon /var/swap.1