Skip to content

Instantly share code, notes, and snippets.

@huguangju
Last active March 26, 2017 02:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save huguangju/b94ae64176be4b7d285d3d6a7a8be4c2 to your computer and use it in GitHub Desktop.
Save huguangju/b94ae64176be4b7d285d3d6a7a8be4c2 to your computer and use it in GitHub Desktop.
npm install node-sass failed
...

gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` succeeded python2 /usr/local/opt/pyenv/shims/python2
gyp ERR! configure error
gyp ERR! stack Error: Command failed: /usr/local/opt/pyenv/shims/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.13
gyp ERR! stack
gyp ERR! stack
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:206:12)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at maybeClose (internal/child_process.js:877:16)
gyp ERR! stack     at Socket.<anonymous> (internal/child_process.js:334:11)
gyp ERR! stack     at emitOne (events.js:96:13)
gyp ERR! stack     at Socket.emit (events.js:188:7)
gyp ERR! stack     at Pipe._handle.close [as _onclose] (net.js:498:12)
gyp ERR! System Darwin 16.1.0
gyp ERR! command "/Users/carson/.nvm/versions/node/v6.9.4/bin/node" "/Users/carson/programming/github/javascript/Angular2/ng2-admin/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /Users/carson/programming/github/javascript/Angular2/ng2-admin/node_modules/wintersmith-sassy/node_modules/node-sass
gyp ERR! node -v v6.9.4
gyp ERR! node-gyp -v v3.6.0
gyp ERR! not ok
Build failed with error code: 1
npm WARN bootstrap-loader@2.0.0-beta.21 requires a peer of eslint-plugin-jsx-a11y@^2.2.3 but none was installed.
npm WARN bootstrap-loader@2.0.0-beta.21 requires a peer of eslint-plugin-react@^6.6.0 but none was installed.
npm ERR! Darwin 16.1.0
npm ERR! argv "/Users/carson/.nvm/versions/node/v6.9.4/bin/node" "/Users/carson/.nvm/versions/node/v6.9.4/bin/npm" "i"
npm ERR! node v6.9.4
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE

npm ERR! node-sass@3.13.1 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!

... ...

错误原因

是由于python版本导致的。系统默认版本为3,但node-sass安装时需要python2

解决方式

npm config set python /usr/bin/python2.7

参考

electron-userland/electron-builder#638

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment