gyp_main.py: error: no such option: --no-parallel

时间:2015-08-06 13:54:20

标签: python node.js ubuntu npm node-gyp

running npm install to install development dependencies of sinopia project, I get this node-gyp configure error:

> fs-ext@0.4.5 install /home/remi/_projects/gitlab/SWAP/sirap-private-npm/node_modules/fs-ext
> node-gyp configure build

Usage: gyp_main.py [options ...] [build_file ...]

gyp_main.py: error: no such option: --no-parallel
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onCpExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:340:16)
gyp ERR! stack     at ChildProcess.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:820:12)
gyp ERR! System Linux 3.16.0-29-generic
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "build"
gyp ERR! cwd /home/remi/_projects/gitlab/SWAP/sirap-private-npm/node_modules/fs-ext
gyp ERR! node -v v0.10.40
gyp ERR! node-gyp -v v0.13.0
gyp ERR! not ok 

Tried

npm cache clean

and

npm install

some times but no effect. Always throwing this error. node-gyp can't build.

2 个答案:

答案 0 :(得分:1)

It seems that gyp depends on python 2.6 and don't support python 2.7 yet.

You must downgrade python version thanks to fkrull's PPA:

sudo add-apt-repository ppa:fkrull/deadsnakes
sudo apt-get update
sudo apt-get install python2.6
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.6 20
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 10

If you want to change this choice later

sudo update-alternatives --config python

This CLI interface will ask you wich version is used automatically, and wich ones must be used manually.

Then, in your project folder :

npm cache clean
npm install

Now it works.

答案 1 :(得分:1)

使用它来升级npm:

内部使用的gyp版本

sudo npm explore npm -g -- npm install node-gyp@latest

请参阅https://github.com/nodejs/node-gyp/wiki/Updating-npm%27s-bundled-node-gyp