欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

npm install 报错 -----Cannot download "node-sass”

程序员文章站 2022-05-29 10:18:07
...
node scripts/install.js
Cannot download "https://github.com/sass/node-sass/releases/download/v3.8.0/win32-x64-48_binding.node"
----------------
gyp info it worked if it ends with ok
gyp verb cli [ 'D:\\azml\\nodejs\\node.exe',
gyp verb cli   'E:\\test\\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 info using [email protected]
gyp info using [email protected] | 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
--------------------- 

查找原因----------主要是windows平台缺少编译环境

1.npm install -g node-gyp 

2.npm install --global --production windows-build-tools 

报错:The build tools cannot be installed without administrative rights.To fix, right-click on PowerShell and run "as Administrator".

进入PowerShell以管理员身份运行上面代码

3.npm uninstall node-sass

4.npm install node-sass

npm install