微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

无法安装 npm gulp-sass --save-dev

如何解决无法安装 npm gulp-sass --save-dev

我是 Node.js 的新手,刚刚开始学习,我需要安装 gulp-sass,但每次尝试时我都会遇到错误

我已经尝试过删除node_modules重新安装gulp清理缓存。如果有人知道安装出了什么问题,我将不胜感激,我会继续努力弄清楚。

npm i gulp-sass --save-dev 
npm ERR! code 1
npm ERR! path C:\Users\jona0\FestivalMusica_inicio\node_modules\gulp-sass\node_modules\node-sass
npm ERR! command Failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node scripts/build.js
npm ERR! Building: C:\Program Files\nodejs\node.exe C:\Users\jona0\FestivalMusica_inicio\node_modules\gulp-sass\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp verb cli [
npm ERR! gyp verb cli   'C:\\Program Files\\nodejs\\node.exe',npm ERR! gyp verb cli   'C:\\Users\\jona0\\FestivalMusica_inicio\\node_modules\\gulp-sass\\node_modules\\node-gyp\\bin\\node-gyp.js',npm ERR! gyp verb cli   'rebuild',npm ERR! gyp verb cli   '--verbose',npm ERR! gyp verb cli   '--libsass_ext=',npm ERR! gyp verb cli   '--libsass_cflags=',npm ERR! gyp verb cli   '--libsass_ldflags=',npm ERR! gyp verb cli   '--libsass_library='
npm ERR! gyp verb cli ]
npm ERR! gyp info using node-gyp@3.8.0
npm ERR! gyp info using node@15.7.0 | win32 | x64
npm ERR! gyp verb command rebuild []
npm ERR! gyp verb command clean []
npm ERR! gyp verb clean removing "build" directory
npm ERR! gyp verb command configure []
npm ERR! gyp verb check python checking for Python executable "python2" in the PATH
npm ERR! gyp verb `which` Failed Error: not found: python2
npm ERR! gyp verb `which` Failed     at getNotFoundError (C:\Users\jona0\FestivalMusica_inicio\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` Failed     at F (C:\Users\jona0\FestivalMusica_inicio\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` Failed     at E (C:\Users\jona0\FestivalMusica_inicio\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` Failed     at C:\Users\jona0\FestivalMusica_inicio\node_modules\which\which.js:89:16
npm ERR! gyp verb `which` Failed     at C:\Users\jona0\FestivalMusica_inicio\node_modules\isexe\index.js:42:5
npm ERR! gyp verb `which` Failed     at C:\Users\jona0\FestivalMusica_inicio\node_modules\isexe\windows.js:36:5
npm ERR! gyp verb `which` Failed     at FSReqCallback.oncomplete (node:fs:194:21)
npm ERR! gyp verb `which` Failed  python2 Error: not found: python2
npm ERR! gyp verb `which` Failed     at getNotFoundError (C:\Users\jona0\FestivalMusica_inicio\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` Failed     at F (C:\Users\jona0\FestivalMusica_inicio\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` Failed     at E (C:\Users\jona0\FestivalMusica_inicio\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` Failed     at C:\Users\jona0\FestivalMusica_inicio\node_modules\which\which.js:89:16
npm ERR! gyp verb `which` Failed     at C:\Users\jona0\FestivalMusica_inicio\node_modules\isexe\index.js:42:5
npm ERR! gyp verb `which` Failed     at C:\Users\jona0\FestivalMusica_inicio\node_modules\isexe\windows.js:36:5
npm ERR! gyp verb `which` Failed     at FSReqCallback.oncomplete (node:fs:194:21) {
npm ERR! gyp verb `which` Failed   code: 'ENOENT'
npm ERR! gyp verb `which` Failed }
npm ERR! gyp verb check python checking for Python executable "python" in the PATH
npm ERR! gyp verb `which` Failed Error: not found: python
npm ERR! gyp verb `which` Failed     at getNotFoundError (C:\Users\jona0\FestivalMusica_inicio\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` Failed     at F (C:\Users\jona0\FestivalMusica_inicio\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` Failed     at E (C:\Users\jona0\FestivalMusica_inicio\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` Failed     at C:\Users\jona0\FestivalMusica_inicio\node_modules\which\which.js:89:16
npm ERR! gyp verb `which` Failed     at C:\Users\jona0\FestivalMusica_inicio\node_modules\isexe\index.js:42:5
npm ERR! gyp verb `which` Failed     at C:\Users\jona0\FestivalMusica_inicio\node_modules\isexe\windows.js:36:5
npm ERR! gyp verb `which` Failed     at FSReqCallback.oncomplete (node:fs:194:21)
npm ERR! gyp verb `which` Failed  python Error: not found: python
npm ERR! gyp verb `which` Failed     at getNotFoundError (C:\Users\jona0\FestivalMusica_inicio\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` Failed     at F (C:\Users\jona0\FestivalMusica_inicio\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` Failed     at E (C:\Users\jona0\FestivalMusica_inicio\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` Failed     at C:\Users\jona0\FestivalMusica_inicio\node_modules\which\which.js:89:16
npm ERR! gyp verb `which` Failed     at C:\Users\jona0\FestivalMusica_inicio\node_modules\isexe\index.js:42:5
npm ERR! gyp verb `which` Failed     at C:\Users\jona0\FestivalMusica_inicio\node_modules\isexe\windows.js:36:5
npm ERR! gyp verb `which` Failed     at FSReqCallback.oncomplete (node:fs:194:21) {
npm ERR! gyp verb `which` Failed   code: 'ENOENT'
npm ERR! gyp verb `which` Failed }
npm ERR! gyp verb Could not find "python". checking python launcher
npm ERR! gyp verb Could not find "python". guessing location
npm ERR! gyp verb ensuring that file exists: C:\Python27\python.exe
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Can't find Python executable "python",you can set the PYTHON env variable.
npm ERR! gyp ERR! stack     at PythonFinder.failnopython (C:\Users\jona0\FestivalMusica_inicio\node_modules\gulp-sass\node_modules\node-gyp\lib\configure.js:484:19)   
npm ERR! gyp ERR! stack     at PythonFinder.<anonymous> (C:\Users\jona0\FestivalMusica_inicio\node_modules\gulp-sass\node_modules\node-gyp\lib\configure.js:509:16)    
npm ERR! gyp ERR! stack     at callback (C:\Users\jona0\FestivalMusica_inicio\node_modules\graceful-fs\polyfills.js:295:20)
npm ERR! gyp ERR! stack     at FSReqCallback.oncomplete (node:fs:194:21)
npm ERR! gyp ERR! System Windows_NT 10.0.19042
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\jona0\\FestivalMusica_inicio\\node_modules\\gulp-sass\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! gyp ERR! cwd C:\Users\jona0\FestivalMusica_inicio\node_modules\gulp-sass\node_modules\node-sass
npm ERR! gyp ERR! node -v v15.7.0
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
npm ERR! Build Failed with error code: 1

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\jona0\AppData\Local\npm-cache\_logs\2021-02-03T01_38_54_026Z-debug.log

解决方法

您必须将 python 添加到您的 PATH 变量中。您可以做的一件事是现在编辑您的 Path 变量并添加

;%PYTHON%;

你的变量 PYTHON 应该指向你的 python 安装的根目录。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?