[英]error ~node_modules/node-sass: Command failed Exit code: 1 Command: node scripts/build.js when running rails new application
Exit code: 1
Command: node scripts/build.js
Arguments:
Directory: ~/workspace/testest/node_modules/node-sass
Output:
Building: ~/.nvm/versions/node/v15.4.0/bin/node ~/workspace/testest/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb `which` failed code: 'ENOENT'
gyp verb `which` failed }
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack at PythonFinder.failNoPython (~workspace/testest/node_modules/node-gyp/lib/configure.js:484:19)
gyp ERR! stack at PythonFinder.<anonymous> (~workspace/testest/node_modules/node-gyp/lib/configure.js:406:16)
gyp ERR! command "~.nvm/versions/node/v15.4.0/bin/node" "~workspace/testest/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd ~workspace/testest/node_modules/node-sass
gyp ERR! node -v v15.4.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1
真的不知道实际发生了什么。 我不知道这是什么时候发生的(我为我的学习构建了很多 Rails 应用程序,但之前没有问题)但最近才注意到。
确保您的机器上安装了 python。
在您的终端上运行which python
它应该返回您的 python 位置路径,看起来像
/usr/local/bin/python
然后运行
npm config set python </usr/local/bin/python>
或者
只需运行export PYTHON="$(which python3)"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.