首页 前端知识 npm install node-sass@2.1.1报编译错误缺node-gyp

npm install node-sass@2.1.1报编译错误缺node-gyp

2024-08-30 03:08:49 前端知识 前端哥 695 92 我要收藏

Error: Cannot find module 'D:\works\ui\node_modules\node-sass\node_modules\pangyp\bin\node-gyp'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
Build failed
npm WARN uxbox-ui@0.0.0 No repository field.
npm WARN uxbox-ui@0.0.0 license should be a valid SPDX license expression
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (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"})

+ node-sass@2.1.1
updated 1 package in 25.056s

npm install -g pangyp@2.1.0

D:\works\ui\node_modules\node-sass>node scripts\build.js    
gyp info it worked if it ends with ok
gyp info using pangyp@2.1.0
gyp info using node@10.24.1 | win32 | x64
gyp ERR! configure error 
gyp ERR! stack Error: Python executable "python" is v3.8.10, which is not supported by gyp.
gyp ERR! stack You can pass the --python switch to point to Python >= v2.5.0 & < 3.0.0.
gyp ERR! stack     at failPythonVersion (D:\works\ui\node_modules\node-sass\node_modules\pangyp\lib\configure.js:109:14)
gyp ERR! stack     at D:\works\ui\node_modules\node-sass\node_modules\pangyp\lib\configure.js:98:9
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:285:7)
gyp ERR! stack     at ChildProcess.emit (events.js:198:13)
gyp ERR! stack     at maybeClose (internal/child_process.js:982:16)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
gyp ERR! System Windows_NT 10.0.19045
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "D:\\works\\ui\\node_modules\\node-sass\\node_modules\\pangyp\\bin\\node-gyp" "rebuild"
gyp ERR! cwd D:\works\ui\node_modules\node-sass
gyp ERR! node -v v10.24.1
gyp ERR! pangyp -v v2.1.0
gyp ERR! not ok
Build failed
 

D:\works\ui\node_modules\node-sass>node scripts\build.js    
gyp info it worked if it ends with ok
gyp info using pangyp@2.1.0
gyp info using node@10.24.1 | win32 | x64
gyp ERR! configure error 
gyp ERR! stack Error: Python executable "python" is v3.8.10, which is not supported by gyp.
gyp ERR! stack You can pass the --python switch to point to Python >= v2.5.0 & < 3.0.0.
gyp ERR! stack     at failPythonVersion (D:\works\ui\node_modules\node-sass\node_modules\pangyp\lib\configure.js:109:14)
gyp ERR! stack     at D:\works\ui\node_modules\node-sass\node_modules\pangyp\lib\configure.js:98:9
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:285:7)
gyp ERR! stack     at ChildProcess.emit (events.js:198:13)
gyp ERR! stack     at maybeClose (internal/child_process.js:982:16)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
gyp ERR! System Windows_NT 10.0.19045
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "D:\\works\\ui\\node_modules\\node-sass\\node_modules\\pangyp\\bin\\node-gyp" "rebuild"
gyp ERR! cwd D:\works\ui\node_modules\node-sass
gyp ERR! node -v v10.24.1
gyp ERR! pangyp -v v2.1.0
gyp ERR! not ok
Build failed

python版本太高了,node-gyp跑不了:

C:\Users\Administrator>py --list-paths
Installed Pythons found by py Launcher for Windows
 -3.8-64        D:\apps\Python3.8.10\python.exe *

 set npm_config_python=D:\apps\Anaconda3\envs\python27\python.exe

D:\works\ui\node_modules\node-sass>node scripts\build.js
gyp info it worked if it ends with ok
gyp info using pangyp@2.1.0
gyp info using node@10.24.1 | win32 | x64
gyp http GET https://iojs.org/dist/v10.24.1/iojs-v10.24.1.tar.gz
gyp http 404 https://iojs.org/dist/v10.24.1/iojs-v10.24.1.tar.gz
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: 404 status code downloading tarball
gyp ERR! stack     at Request.<anonymous> (D:\works\ui\node_modules\node-sass\node_modules\pangyp\lib\install.js:251:14)
gyp ERR! stack     at Request.emit (events.js:203:15)
gyp ERR! stack     at Request.onRequestResponse (D:\works\ui\node_modules\node-sass\node_modules\pangyp\node_modules\request\request.js:1255:10)
gyp ERR! stack     at ClientRequest.emit (events.js:198:13)
gyp ERR! stack     at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:565:21) 

D:\works\ui\node_modules\node-sass>node scripts\build.js
gyp info it worked if it ends with ok
gyp info using pangyp@2.3.3
gyp info using node@10.24.1 | win32 | x64
gyp http GET http://nodejs.org/dist/v10.24.1/node-v10.24.1.tar.gz
gyp http 200 http://nodejs.org/dist/v10.24.1/node-v10.24.1.tar.gz
^C
D:\works\ui\node_modules\node-sass>

D:\works\ui\node_modules\node-sass>
D:\works\ui\node_modules\node-sass>node scripts\build.js
gyp info it worked if it ends with ok
gyp info using pangyp@2.3.3
gyp info using node@10.24.1 | win32 | x64
gyp info spawn D:\apps\Anaconda3\envs\python27\python.exe
gyp info spawn args [ 'D:\\works\\ui\\node_modules\\node-sass\\node_modules\\pangyp\\gyp\\gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'msvs',
gyp info spawn args   '-G',
gyp info spawn args   'msvs_version=auto',
gyp info spawn args   '-I',
gyp info spawn args   'D:\\works\\ui\\node_modules\\node-sass\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'D:\\works\\ui\\node_modules\\node-sass\\node_modules\\pangyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\Administrator\\.node-gyp\\10.24.1\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=C:\\Users\\Administrator\\.node-gyp\\10.24.1',
gyp info spawn args   '-Druntime=node',
gyp info spawn args   '-Dmodule_root_dir=D:\\works\\ui\\node_modules\\node-sass',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'D:\\works\\ui\\node_modules\\node-sass\\build',
gyp info spawn args   '-Goutput_dir=.' ]
Warning: unrecognized setting VCCLCompilerTool/MultiProcessorCompilation
Warning: unrecognized setting VCCLCompilerTool/MultiProcessorCompilation
gyp ERR! build error 
gyp ERR! stack Error: ENOENT: no such file or directory, open 'C:\Users\Administrator\.node-gyp\10.24.1\x64\node.lib'
gyp ERR! System Windows_NT 10.0.19045
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "D:\\works\\ui\\node_modules\\node-sass\\node_modules\\pangyp\\bin\\node-gyp" "rebuild"
gyp ERR! cwd D:\works\ui\node_modules\node-sass
gyp ERR! node -v v10.24.1
gyp ERR! pangyp -v v2.3.3
gyp ERR! not ok
Build failed 

Release 改成 x64

Warning: unrecognized setting VCCLCompilerTool/MultiProcessorCompilation
gyp info spawn C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe
gyp info spawn args [ 'build/binding.sln',
gyp info spawn args   '/clp:Verbosity=minimal',
gyp info spawn args   '/nologo',
gyp info spawn args   '/p:Configuration=Release;Platform=x64' ]
在此解决方案中一次生成一个项目。若要启用并行生成,请添加“/m”开关。
MSBUILD : error MSB4132: 无法识别工具版本“2.0”。可用的工具版本为 "4.0"。
gyp ERR! build error 
gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (D:\works\ui\node_modules\node-sass\node_modules\pangyp\lib\build.js:272:23)
gyp ERR! stack     at ChildProcess.emit (events.js:198:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Windows_NT 10.0.19045
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "D:\\works\\ui\\node_modules\\node-sass\\node_modules\\pangyp\\bin\\node-gyp" "rebuild"
gyp ERR! cwd D:\works\ui\node_modules\node-sass
gyp ERR! node -v v10.24.1
gyp ERR! pangyp -v v2.3.3
gyp ERR! not ok
Build failed 

 

---跟新下这个版本

D:\works\ui>npm install gulp-sass@3.2.1
npm WARN deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm WARN deprecated glob@7.1.7: Glob versions prior to v9 are no longer supported
npm WARN deprecated osenv@0.1.5: This package is no longer supported.
npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
npm WARN deprecated fstream@1.0.12: This package is no longer supported.

> node-sass@4.14.1 install D:\works\ui\node_modules\gulp-sass\node_modules\node-sass
> node scripts/install.js

Downloading binary from https://github.com/sass/node-sass/releases/download/v4.14.1/win32-x64-64_binding.node
Download complete..] - :
Binary saved to D:\works\ui\node_modules\gulp-sass\node_modules\node-sass\vendor\win32-x64-64\binding.node
Caching binary to C:\Users\Administrator\AppData\Roaming\npm-cache\node-sass\4.14.1\win32-x64-64_binding.node

> node-sass@4.14.1 postinstall D:\works\ui\node_modules\gulp-sass\node_modules\node-sass
> node scripts/build.js

Binary found at D:\works\ui\node_modules\gulp-sass\node_modules\node-sass\vendor\win32-x64-64\binding.node
Testing binary
Binary is fine
npm WARN uxbox-ui@0.0.0 No repository field.
npm WARN uxbox-ui@0.0.0 license should be a valid SPDX license expression
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (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"})

+ gulp-sass@3.2.1
added 33 packages from 16 contributors and removed 3 packages in 23.212s

32 packages are looking for funding
  run `npm fund` for details


D:\works\ui>gulp
[07:27:13] Using gulpfile D:\works\ui\gulpfile.js
[07:27:13] Starting 'jade'...
[07:27:13] Starting 'scss'...
[07:27:13] Starting 'copyVendor'...
[07:27:13] Finished 'copyVendor' after 471 μs
[07:27:13] Starting 'copyFonts'...
[07:27:13] Finished 'copyFonts' after 467 μs
[07:27:13] Starting 'copyImages'...
[07:27:13] Finished 'copyImages' after 380 μs
[07:27:13] Starting 'copyScripts'...
[07:27:13] Finished 'copyScripts' after 4.56 ms
[07:27:13] Starting 'copy'...
[07:27:13] Finished 'copy' after 46 μs
[07:27:13] Starting 'browser-sync'...
[07:27:13] Finished 'browser-sync' after 91 ms
DEPRECATION WARNING: Passing 100, a non-string value, to unquote()
will be an error in future versions of Sass.
        on line 103 of D:/works/ui/app/styles/dependencies/mixin.scss
DEPRECATION WARNING: Passing 100, a non-string value, to unquote()
will be an error in future versions of Sass.
        on line 103 of D:/works/ui/app/styles/dependencies/mixin.scss
DEPRECATION WARNING: Passing 200, a non-string value, to unquote()
will be an error in future versions of Sass.
        on line 103 of D:/works/ui/app/styles/dependencies/mixin.scss
DEPRECATION WARNING: Passing 200, a non-string value, to unquote()
will be an error in future versions of Sass.
        on line 103 of D:/works/ui/app/styles/dependencies/mixin.scss
DEPRECATION WARNING: Passing 500, a non-string value, to unquote()
will be an error in future versions of Sass.
        on line 103 of D:/works/ui/app/styles/dependencies/mixin.scss
DEPRECATION WARNING: Passing 500, a non-string value, to unquote()
will be an error in future versions of Sass.
        on line 103 of D:/works/ui/app/styles/dependencies/mixin.scss
DEPRECATION WARNING: Passing 900, a non-string value, to unquote()
will be an error in future versions of Sass.
        on line 103 of D:/works/ui/app/styles/dependencies/mixin.scss
DEPRECATION WARNING: Passing 900, a non-string value, to unquote()
will be an error in future versions of Sass.
        on line 103 of D:/works/ui/app/styles/dependencies/mixin.scss
[BS] 0 file changed ()
[07:27:13] Finished 'scss' after 283 ms
[07:27:13] Starting 'autoprefixer'...
[07:27:13] Finished 'autoprefixer' after 161 ms
[BS] 0 file changed ()
[07:27:13] Finished 'jade' after 487 ms
[07:27:13] Starting 'dist'...
[07:27:13] Finished 'dist' after 4.9 μs
[07:27:13] Starting 'default'...
[07:27:14] Finished 'default' after 479 ms
[BS] Local URL: http://localhost:3000
[BS] External URL: http://26.26.26.1:3000
[BS] Serving files from: dist/
 

转载请注明出处或者链接地址:https://www.qianduange.cn//article/17192.html
标签
rust
评论
发布的文章

npm install 报错解决记录

2024-09-09 00:09:08

大家推荐的文章
会员中心 联系我 留言建议 回顶部
复制成功!