Search code examples
pythonnode.jsubuntunpmnode-gyp

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


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.


Solution

  • 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.