npm install异常

异常信息

gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:\Users\zp\.pyenv\pyenv-win\shims\python.BAT -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack   File "<string>", line 1
gyp ERR! stack     import sys; print "s. sys.version_info[:3];
gyp ERR! stack                                               ^
gyp ERR! stack SyntaxError: EOL while scanning string literal
gyp ERR! stack
gyp ERR! stack     at ChildProcess.exithandler (node:child_process:398:12)
gyp ERR! stack     at ChildProcess.emit (node:events:527:28)
gyp ERR! stack     at maybeClose (node:internal/child_process:1092:16)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
gyp ERR! System Windows_NT 10.0.22000
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "D:\\DEV\\IT_OS\\it_os_vue\\node_modules\\_node-gyp@3.8.0@node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd D:\DEV\IT_OS\it_os_vue\node_modules\_node-sass@4.14.1@node-sass
gyp ERR! node -v v16.15.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1
[npminstall:runscript:error] vue-awesome-mui@1.7.3 › node-sass@^4.5.3 scripts.postinstall run "node scripts/build.js" error: Error [RunScriptError]: Run "C:\Windows\system32\cmd.exe /d /s /c node scripts/build.js" error, exit code 1
    at ChildProcess.<anonymous> (C:\Users\zp\AppData\Roaming\npm\node_modules\cnpm\node_modules\runscript\index.js:96:21)
    at ChildProcess.emit (node:events:527:28)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12) {
  stdio: [Object],
  exitcode: 1
}
× Install fail! RunScriptError: post install error, please remove node_modules before retry!
Run "C:\Windows\system32\cmd.exe /d /s /c node scripts/build.js" error, exit code 1
RunScriptError: Run "C:\Windows\system32\cmd.exe /d /s /c node scripts/build.js" error, exit code 1
    at ChildProcess.<anonymous> (C:\Users\zp\AppData\Roaming\npm\node_modules\cnpm\node_modules\runscript\index.js:96:21)
    at ChildProcess.emit (node:events:527:28)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
npminstall version: 6.2.0
npminstall args: C:\Program Files\nodejs\node.exe C:\Users\zp\AppData\Roaming\npm\node_modules\cnpm\node_modules\npminstall\bin\install.js --fix-bug-versions --china --userconfig=C:\Users\zp\.cnpmrc --disturl=https://npmmirror.com/mirrors/node --registry=https://registry.npmmirror.com

解决方式

下面命令执行两次就好

npm install -g cnpm --registry=https://registry.npm.taobao.org
cnpm install

2022-6-4 15:57:57

点赞