npm install failed at node-sass command failed
创始人
2024-06-02 18:05:15
0

npm install failed at node-sass command failed

  • npm install 执行后出现如下错误
    • 错误信息
    • 错误分析过程
    • 错误解决
  • 我是将军,我一直都在,。!

npm install 执行后出现如下错误

我维护了一个项目,web页面是使用Angular.js和一些实用程序开发的,但当我使用“npm install”命令时出现了错误,错误日志显示在下面

错误信息

npm ERR! code 1
npm ERR! path D:\FDisk\001-processing\subtlechat-vue\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: D:\Software\200-Brick\210-Tool\218-Node.js\02-Application\node.exe D:\FDisk\001-processing\subtlechat-vue\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   'D:\\Software\\200-Brick\\210-Tool\\218-Node.js\\02-Application\\node.exe',
npm ERR! gyp verb cli   'D:\\FDisk\\001-processing\\subtlechat-vue\\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@16.18.1 | 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 (D:\FDisk\001-processing\subtlechat-vue\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` failed     at F (D:\FDisk\001-processing\subtlechat-vue\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed     at E (D:\FDisk\001-processing\subtlechat-vue\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed     at D:\FDisk\001-processing\subtlechat-vue\node_modules\which\which.js:89:16  
npm ERR! gyp verb `which` failed     at D:\FDisk\001-processing\subtlechat-vue\node_modules\isexe\index.js:42:5   
npm ERR! gyp verb `which` failed     at D:\FDisk\001-processing\subtlechat-vue\node_modules\isexe\windows.js:36:5 
npm ERR! gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:202:21)
npm ERR! gyp verb `which` failed  python2 Error: not found: python2
npm ERR! gyp verb `which` failed     at getNotFoundError (D:\FDisk\001-processing\subtlechat-vue\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` failed     at F (D:\FDisk\001-processing\subtlechat-vue\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed     at E (D:\FDisk\001-processing\subtlechat-vue\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed     at D:\FDisk\001-processing\subtlechat-vue\node_modules\which\which.js:89:16  
npm ERR! gyp verb `which` failed     at D:\FDisk\001-processing\subtlechat-vue\node_modules\isexe\index.js:42:5   
npm ERR! gyp verb `which` failed     at D:\FDisk\001-processing\subtlechat-vue\node_modules\isexe\windows.js:36:5 
npm ERR! gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:202: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 (D:\FDisk\001-processing\subtlechat-vue\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` failed     at F (D:\FDisk\001-processing\subtlechat-vue\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed     at E (D:\FDisk\001-processing\subtlechat-vue\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed     at D:\FDisk\001-processing\subtlechat-vue\node_modules\which\which.js:89:16  
npm ERR! gyp verb `which` failed     at D:\FDisk\001-processing\subtlechat-vue\node_modules\isexe\index.js:42:5   
npm ERR! gyp verb `which` failed     at D:\FDisk\001-processing\subtlechat-vue\node_modules\isexe\windows.js:36:5 
npm ERR! gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:202:21)
npm ERR! gyp verb `which` failed  python Error: not found: python
npm ERR! gyp verb `which` failed     at getNotFoundError (D:\FDisk\001-processing\subtlechat-vue\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` failed     at F (D:\FDisk\001-processing\subtlechat-vue\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed     at E (D:\FDisk\001-processing\subtlechat-vue\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed     at D:\FDisk\001-processing\subtlechat-vue\node_modules\which\which.js:89:16  
npm ERR! gyp verb `which` failed     at D:\FDisk\001-processing\subtlechat-vue\node_modules\isexe\index.js:42:5   
npm ERR! gyp verb `which` failed     at D:\FDisk\001-processing\subtlechat-vue\node_modules\isexe\windows.js:36:5 
npm ERR! gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:202: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 (D:\FDisk\001-processing\subtlechat-vue\node_modules\node-gyp\lib\configure.js:484:19)
npm ERR! gyp ERR! stack     at PythonFinder. (D:\FDisk\001-processing\subtlechat-vue\node_modules\node-gyp\lib\configure.js:509:16)
npm ERR! gyp ERR! stack     at callback (D:\FDisk\001-processing\subtlechat-vue\node_modules\graceful-fs\polyfills.js:295:20)
npm ERR! gyp ERR! stack     at FSReqCallback.oncomplete (node:fs:202:21)
npm ERR! gyp ERR! System Windows_NT 10.0.19044
npm ERR! gyp ERR! command "D:\\Software\\200-Brick\\210-Tool\\218-Node.js\\02-Application\\node.exe" "D:\\FDisk\\001-processing\\subtlechat-vue\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! gyp ERR! cwd D:\FDisk\001-processing\subtlechat-vue\node_modules\node-sass
npm ERR! gyp ERR! node -v v16.18.1
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
npm ERR! Build failed with error code: 1npm ERR! A complete log of this run can be found in:
npm ERR!     D:\Software\200-Brick\210-Tool\218-Node.js\02-Application\node_cache\_logs\2023-03-13T06_34_38_773Z-debug-0.log

错误分析过程

我上网查阅了很多信息
包括什么node版本问题;或者说一些命令执行方法,和配置node相关文件的权限和环境变量,结果显而易见,都失败了
最后我上网查看了vue和node的官方文档,也尝试了很多次,最后终于解决了这个问题
改Bug就是这样,每个人的错误可能因为一小点小小的差异,而导致大大的不同,在这里我只提供,我所解决的方法,至于是否适用于阁下的错误,还请试试再说

错误解决

这通常是因为运行npm install后环境发生了变化。运行npm rebuild node-sass下载当前环境的绑定。
所以我运行了npm rebuild node-sass,结果成功了!然后安装npm,一切正常。

解决步骤,按顺序执行下列命令,之后直接运行项目就行,不需要再次执行npm install
一:

npm uninstall node-sass

二:

npm i -D sass

三:

npm i

我是将军,我一直都在,。!

相关内容

热门资讯

Python|位运算|数组|动... 目录 1、只出现一次的数字(位运算,数组) 示例 选项代...
张岱的人物生平 张岱的人物生平张岱(414年-484年),字景山,吴郡吴县(今江苏苏州)人。南朝齐大臣。祖父张敞,东...
西游西后传演员女人物 西游西后传演员女人物西游西后传演员女人物 孙悟空 六小龄童 唐僧 徐少华 ...
名人故事中贾岛作诗内容简介 名人故事中贾岛作诗内容简介有一次,贾岛骑驴闯了官道.他正琢磨着一句诗,名叫《题李凝幽居》全诗如下:闲...
和男朋友一起优秀的文案? 和男朋友一起优秀的文案?1.希望是惟一所有的人都共同享有的好处;一无所有的人,仍拥有希望。2.生活,...
戴玉手镯的好处 戴玉手镯好还是... 戴玉手镯的好处 戴玉手镯好还是碧玺好 女人戴玉?戴玉好还是碧玺好点佩戴手镯,以和田玉手镯为佳!相嫌滑...
依然什么意思? 依然什么意思?依然(汉语词语)依然,汉语词汇。拼音:yī    rán基本解释:副词,指照往常、依旧...
高尔基的散文诗 高尔基的散文诗《海燕》、《大学》、《母亲》、《童年》这些都是比较出名的一些代表作。
心在飞扬作者简介 心在飞扬作者简介心在飞扬作者简介如下。根据相关公开资料查询,心在飞扬是一位优秀的小说作者,他的小说作...
卡什坦卡的故事赏析? 卡什坦卡的故事赏析?讲了一只小狗的故事, 我也是近来才读到这篇小说. 作家对动物的拟人描写真是惟妙...
林绍涛为简艾拿绿豆糕是哪一集 林绍涛为简艾拿绿豆糕是哪一集第三十二集。 贾宽认为是阎帅间接导致刘映霞住了院,第二天上班,他按捺不...
小爱同学是女生吗小安同学什么意... 小爱同学是女生吗小安同学什么意思 小爱同学,小安同学说你是女生。小安是男的。
内分泌失调导致脸上长斑,怎么调... 内分泌失调导致脸上长斑,怎么调理内分泌失调导致脸上长斑,怎么调理先调理内分泌,去看中医吧,另外用好的...
《魔幻仙境》刺客,骑士人物属性... 《魔幻仙境》刺客,骑士人物属性加点魔幻仙境骑士2功1体质
很喜欢她,该怎么办? 很喜欢她,该怎么办?太冷静了!! 太理智了!爱情是需要冲劲的~不要考虑着考虑那~否则缘...
言情小说作家 言情小说作家我比较喜欢匪我思存的,很虐,很悲,还有梅子黄时雨,笙离,叶萱,还有安宁的《温暖的玄》 小...
两个以名人的名字命名的风景名胜... 两个以名人的名字命名的风景名胜?快太白楼,李白。尚志公园,赵尚志。
幼儿教育的代表人物及其著作 幼儿教育的代表人物及其著作卡尔威特的《卡尔威特的教育》,小卡尔威特,他儿子成了天才后写的《小卡尔威特...
海贼王中为什么说路飞打凯多靠霸... 海贼王中为什么说路飞打凯多靠霸气升级?凯多是靠霸气升级吗?因为之前刚到时确实打不过人家因为路飞的实力...
运气不好拜财神有用吗运气不好拜... 运气不好拜财神有用吗运气不好拜财神有没有用1、运气不好拜财神有用。2、拜财神上香前先点蜡烛,照亮人神...