node安装错误报错
比较老的项目,需要维护。安装依赖包是一直报这个错, npm intsall 安装依赖一直失败,到网上查是 node-sass 安装的问题。
> core-js@3.6.5 postinstall B:\vue\Code\vue-cars-admin-master\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"
> ejs@2.7.4 postinstall B:\vue\Code\vue-cars-admin-master\node_modules\ejs
> node ./postinstall.js
Thank you for installing EJS: built with the Jake JavaScript build tool (https://jakejs.com/)
[ ......] | postinstall:num2fraction: info lifecycle num2fraction@1.2.2~postinstall: num[ ......] | postinstall:icss-utils: info lifecycle icss-utils@4.1.1~postinstall: icss-ut[ ......] | postinstall:watchpack: info lifecycle watchpack@1.7.4~postinstall: watchpack
> node-sass@4.14.1 postinstall B:\vue\Code\vue-cars-admin-master\node_modules\node-sass
> node scripts/build.js
Building: D:\myEnvironment\nodejs\node.exe B:\vue\Code\vue-cars-admin-master\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 cli [
gyp verb cli 'D:\\myEnvironment\\nodejs\\node.exe',
gyp verb cli 'B:\\vue\\Code\\vue-cars-admin-master\\node_modules\\node-gyp\\bin\\node-gyp.js',
gyp verb cli 'rebuild',
gyp verb cli '--verbose',
gyp verb cli '--libsass_ext=',
gyp verb cli '--libsass_cflags=',
gyp verb cli '--libsass_ldflags=',
gyp verb cli '--libsass_library='
gyp verb cli ]
gyp info using node-gyp@3.8.0
gyp info using node@12.16.1 | win32 | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` failed Error: not found: python2
gyp verb `which` failed at getNotFoundError (B:\vue\Code\vue-cars-admin-master\node_modules\which\which.js:13:12)
gyp verb `which` failed at F (B:\vue\Code\vue-cars-admin-master\node_modules\which\which.js:68:19)
gyp verb `which` failed at E (B:\vue\Code\vue-cars-admin-master\node_modules\which\which.js:80:29)
gyp verb `which` failed at B:\vue\Code\vue-cars-admin-master\node_modules\which\which.js:89:16
gyp verb `which` failed at B:\vue\Code\vue-cars-admin-master\node_modules\isexe\index.js:42:5
gyp verb `which` failed at B:\vue\Code\vue-cars-admin-master\node_modules\isexe\windows.js:36:5gyp verb `which` failed at FSReqCallback.oncomplete (fs.js:166:21)
gyp verb `which` failed python2 Error: not found: python2
gyp verb `which` failed at getNotFoundError (B:\vue\Code\vue-cars-admin-master\node_modules\which\which.js:13:12)
gyp verb `which` failed at F (B:\vue\Code\vue-cars-admin-master\node_modules\which\which.js:68:19)
gyp verb `which` failed at E (B:\vue\Code\vue-cars-admin-master\node_modules\which\which.js:80:29)
gyp verb `which` failed at B:\vue\Code\vue-cars-admin-master\node_modules\which\which.js:89:16
gyp verb `which` failed at B:\vue\Code\vue-cars-admin-master\node_modules\isexe\index.js:42:5
gyp verb `which` failed at B:\vue\Code\vue-cars-admin-master\node_modules\isexe\windows.js:36:5gyp verb `which` failed at FSReqCallback.oncomplete (fs.js:166:21) {
gyp verb `which` failed stack: 'Error: not found: python2\n' +
gyp verb `which` failed ' at getNotFoundError (B:\\vue\\Code\\vue-cars-admin-master\\node_modules\\which\\which.js:13:12)\n' +
gyp verb `which` failed ' at F (B:\\vue\\Code\\vue-cars-admin-master\\node_modules\\which\\which.js:68:19)\n' +
gyp verb `which` failed ' at E (B:\\vue\\Code\\vue-cars-admin-master\\node_modules\\which\\which.js:80:29)\n' +
gyp verb `which` failed ' at B:\\vue\\Code\\vue-cars-admin-master\\node_modules\\which\\which.js:89:16\n' +
gyp verb `which` failed ' at B:\\vue\\Code\\vue-cars-admin-master\\node_modules\\isexe\\index.js:42:5\n' +
gyp verb `which` failed ' at B:\\vue\\Code\\vue-cars-admin-master\\node_modules\\isexe\\windows.js:36:5\n' +
gyp verb `which` failed ' at FSReqCallback.oncomplete (fs.js:166:21)',
gyp verb `which` failed code: 'ENOENT'
gyp verb `which` failed }
gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` failed Error: not found: python
gyp verb `which` failed at getNotFoundError (B:\vue\Code\vue-cars-admin-master\node_modules\which\which.js:13:12)
gyp verb `which` failed at F (B:\vue\Code\vue-cars-admin-master\node_modules\which\which.js:68:19)
gyp verb `which` failed at E (B:\vue\Code\vue-cars-admin-master\node_modules\which\which.js:80:29)
gyp verb `which` failed at B:\vue\Code\vue-cars-admin-master\node_modules\which\which.js:89:16
gyp verb `which` failed at B:\vue\Code\vue-cars-admin-master\node_modules\isexe\index.js:42:5
gyp verb `which` failed at B:\vue\Code\vue-cars-admin-master\node_modules\isexe\windows.js:36:5gyp verb `which` failed at FSReqCallback.oncomplete (fs.js:166:21)
gyp verb `which` failed python Error: not found: python
gyp verb `which` failed at getNotFoundError (B:\vue\Code\vue-cars-admin-master\node_modules\which\which.js:13:12)
gyp verb `which` failed at F (B:\vue\Code\vue-cars-admin-master\node_modules\which\which.js:68:19)
gyp verb `which` failed at E (B:\vue\Code\vue-cars-admin-master\node_modules\which\which.js:80:29)
gyp verb `which` failed at B:\vue\Code\vue-cars-admin-master\node_modules\which\which.js:89:16
gyp verb `which` failed at B:\vue\Code\vue-cars-admin-master\node_modules\isexe\index.js:42:5
gyp verb `which` failed at B:\vue\Code\vue-cars-admin-master\node_modules\isexe\windows.js:36:5gyp verb `which` failed at FSReqCallback.oncomplete (fs.js:166:21) {
gyp verb `which` failed stack: 'Error: not found: python\n' +
gyp verb `which` failed ' at getNotFoundError (B:\\vue\\Code\\vue-cars-admin-master\\node_modules\\which\\which.js:13:12)\n' +
gyp verb `which` failed ' at F (B:\\vue\\Code\\vue-cars-admin-master\\node_modules\\which\\which.js:68:19)\n' +
gyp verb `which` failed ' at E (B:\\vue\\Code\\vue-cars-admin-master\\node_modules\\which\\which.js:80:29)\n' +
gyp verb `which` failed ' at B:\\vue\\Code\\vue-cars-admin-master\\node_modules\\which\\which.js:89:16\n' +
gyp verb `which` failed ' at B:\\vue\\Code\\vue-cars-admin-master\\node_modules\\isexe\\index.js:42:5\n' +
gyp verb `which` failed ' at B:\\vue\\Code\\vue-cars-admin-master\\node_modules\\isexe\\windows.js:36:5\n' +
gyp verb `which` failed ' at FSReqCallback.oncomplete (fs.js:166:21)',
gyp verb `which` failed code: 'ENOENT'
gyp verb `which` failed }
gyp verb could not find "python". checking python launcher
gyp verb could not find "python". guessing location
gyp verb ensuring that file exists: C:\Python27\python.exe
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 (B:\vue\Code\vue-cars-admin-master\node_modules\node-gyp\lib\configure.js:484:19)
gyp ERR! stack at PythonFinder.<anonymous> (B:\vue\Code\vue-cars-admin-master\node_modules\node-gyp\lib\configure.js:509:16)
gyp ERR! stack at callback (B:\vue\Code\vue-cars-admin-master\node_modules\graceful-fs\polyfills.js:295:20)
gyp ERR! stack at FSReqCallback.oncomplete (fs.js:166:21)
gyp ERR! System Windows_NT 10.0.19041
gyp ERR! command "D:\\myEnvironment\\nodejs\\node.exe" "B:\\vue\\Code\\vue-cars-admin-master\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd B:\vue\Code\vue-cars-admin-master\node_modules\node-sass
gyp ERR! node -v v12.16.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1
[ ......] / postinstall: info lifecycle node-sass@4.14.1~postinstall: Failed to exec pos[ ......] / postinstall: info lifecycle node-sass@4.14.1~postinstall: Failed to exec pos[ ......] - postinstall: info lifecycle node-sass@4.14.1~postinstall: Failed to exec pos[ ......] - postinstall: info lifecycle node-sass@4.14.1~postinstall: Failed to exec pos[ ......] - postinstall: info lifecycle node-sass@4.14.1~postinstall: Failed to exec pos[ ......] - postinstall: info lifecycle node-sass@4.14.1~postinstall: Failed to exec posnpm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_mPENDENCY: fsevents@1.2.13 (node_modules\webpack-dev-server\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) s":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\watchpack-chokidar2\node_modules\fsevents): s":"win32","arch":"x64"})
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) ":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@4.14.1 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@4.14.1 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
分析一下,这个错误的出现是因为sass安装时获取源的问题,修改sass安装的源。 解决办法:使用taobao的npm
npm config set sass_binary_site=https://npm.taobao.org/mirrors/node-sass
回车后,再输入npm install就完美解决了。
npm install```
|