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

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

相关内容

热门资讯

甘肃一幼儿园违规使用添加剂致部... 转自:央视记者今天(3日)从甘肃省天水市麦积区了解到:7月1日,麦积区市场监管局和公安分局接群众反映...
“空中吊车”首战大瑶山 无人机... 转自:新华财经图为南方电网广西来宾供电局的无人机飞手正在调试无人机近日,在苍翠险峻的大瑶山自然保护区...
甘肃一幼儿园违规使用添加剂致部... 转自:天津日报记者今天(3日)从甘肃省天水市麦积区了解到:7月1日,麦积区市场监管局和公安分局接群众...
邮储银行武强县支行开展联建共建... 转自:衡水日报为深入学习贯彻党的二十大精神、全面落实新时代党的建设总要求,7月1日,邮储银行武强县支...
警方否认拘留K1373次列车砸... 【#警方否认拘留K1373次列车砸窗乘客# 仅对其批评教育后放行】#目击者讲述K1373次列车脱线乘...
隆林:递进式气象服务筑牢汛期防... 6月30日至7月1日,广西壮族自治区百色市隆林各族自治县出现入汛以来最强降雨,全县13个站点出现大暴...
万荣:气象服务赋能香菇产业从“... 6月26日,山西省运城市万荣县气象局联合县农业农村局深入南张乡香菇种植基地,开展直通式气象服务。香菇...
天津征求意见:到2027年力争... 天津市科技局对《天津市科技金融助力新质生产力发展行动方案(2025-2027年)》公开征求意见。其中...
长三角一体化发展将推进医疗检查... 转自:上观新闻近日,由上海市卫生健康委员会、江苏省卫生健康委员会、浙江省卫生健康委员会、安徽省卫生健...
“立浙江,塑世界”!“铸脉:浙... 转自:上观新闻“这不仅是一场展览,更是一座丰碑,是浙江百年雕塑与中国雕塑百年同频共振、互为印证、相互...