Search code examples
pythonruby-on-railsrubynode.jsnodemon

ERR! stack Error: Command failed: python2 -c import platform;


I lack knowledge of Ruby Rails and Python tools, therefore gave a senior developer permission to "update" my mac settings in order to allow access and collaborate via github for a project called "pawztech-api".

Now everytime I try to install an npm package, (in this instance nodemon), I get the following error...

unknown-3c-15-c2-d5-97-aa:express dejimeji$ sudo npm install -g nodemon
Password:

> fsevents@0.3.8 install /usr/local/lib/node_modules/nodemon/node_modules/chokidar/node_modules/fsevents
> node-gyp rebuild

gyp ERR! configure error 
gyp ERR! stack Error: Command failed: python2 -c import platform; print(platform.python_version());
gyp ERR! stack pyenv: python2: command not found
gyp ERR! stack 
gyp ERR! stack The `python2' command exists in these Python versions:
gyp ERR! stack   2.7.9
gyp ERR! stack   pawztech-api
gyp ERR! stack 
gyp ERR! stack 
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:751:12)
gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
gyp ERR! stack     at maybeClose (child_process.js:1015:16)
gyp ERR! stack     at Socket.<anonymous> (child_process.js:1183:11)
gyp ERR! stack     at Socket.emit (events.js:107:17)
gyp ERR! stack     at Pipe.close (net.js:485:12)
gyp ERR! System Darwin 13.4.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/nodemon/node_modules/chokidar/node_modules/fsevents
gyp ERR! node -v v0.12.7
gyp ERR! node-gyp -v v2.0.2
gyp ERR! not ok 
npm WARN optional dep failed, continuing fsevents@0.3.8
/usr/local/bin/nodemon -> /usr/local/lib/node_modules/nodemon/bin/nodemon.js
nodemon@1.7.0 /usr/local/lib/node_modules/nodemon

I presume I have the wrong version of Python right?

Anyhow, how can I revert back or restore normal settings so that npm installs the packages without error?


Solution

  • try setting the local pyenv version with

    pyenv local 2.7.9