cnpm install 时报错,请问应该怎么解决呢?

D:\wwwroot\discuz7\resources\frame>cnpm install
- [28/70] Installing imurmurhash@^0.1.4platform unsupported [email protected][email protected][email protected][email protected] › fsevents@~2.1.2 Package require os(darwin) not compatible with your platform(win32)
platform unsupported [email protected][email protected][email protected][email protected][email protected] › fsevents@^1.2.7 Package require os(darwin) not compatible with your platform(win32)
[fsevents@~2.1.2] optional install error: Package require os(darwin) not compatible with your platform(win32)
[fsevents@^1.2.7] optional install error: Package require os(darwin) not compatible with your platform(win32)
√ Installed 70 packages
√ Linked 847 latest versions
[1/4] scripts.postinstall [email protected][email protected] › core-js@^2.4.0 run "node -e \"try{require('./postinstall')}catch(e){}\"", root: "D:\\wwwroot\\discuz7\\resources\\frame\\node_modules\\[email protected]@core-js"
Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
> https://opencollective.com/core-js
> https://www.patreon.com/zloirock

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)

[1/4] scripts.postinstall [email protected][email protected] › core-js@^2.4.0 finished in 69ms
[2/4] scripts.install fibers@^4.0.3 run "node build.js || nodejs build.js", root: "D:\\wwwroot\\discuz7\\resources\\frame\\node_modules\\[email protected]@fibers"

D:\wwwroot\discuz7\resources\frame\node_modules\[email protected]@fibers>node "C:\Users\Wang\AppData\Roaming\npm\node_modules\cnpm\node_modules\npminstall\node-gyp-bin\\node-gyp.js" rebuild --release
gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:\Python39\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack   File "", line 1
gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack                       ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:308:12)
gyp ERR! stack     at ChildProcess.emit (events.js:314:20)
gyp ERR! stack     at maybeClose (internal/child_process.js:1047:16)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
gyp ERR! System Windows_NT 10.0.18363
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Wang\\AppData\\Roaming\\npm\\node_modules\\cnpm\\node_modules\\npminstall\\node-gyp-bin\\node-gyp.js" "rebuild" "--release"
gyp ERR! cwd D:\wwwroot\discuz7\resources\frame\node_modules\[email protected]@fibers
gyp ERR! node -v v14.13.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-gyp exited with code: 1
Please make sure you are using a supported platform and node version. If you
would like to compile fibers on this machine please make sure you have setup your
build environment--
Windows + OS X instructions here: https://github.com/nodejs/node-gyp
Ubuntu users please run: `sudo apt-get install g++ build-essential`
RHEL users please run: `yum install gcc-c++` and `yum groupinstall 'Development Tools'`
Alpine users please run: `sudo apk add python make g++`
'nodejs' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
[npminstall:runscript:error] fibers@^4.0.3 scripts.install run "node build.js || nodejs build.js" error: Error [RunScriptError]: Run "C:\Windows\system32\cmd.exe /d /s /c node build.js || nodejs build.js" error, exit code 1
    at ChildProcess. (C:\Users\Wang\AppData\Roaming\npm\node_modules\cnpm\node_modules\runscript\index.js:96:21)
    at ChildProcess.emit (events.js:314:20)
    at maybeClose (internal/child_process.js:1047:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5) {
  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 build.js || nodejs build.js" error, exit code 1
RunScriptError: Run "C:\Windows\system32\cmd.exe /d /s /c node build.js || nodejs build.js" error, exit code 1
    at ChildProcess. (C:\Users\Wang\AppData\Roaming\npm\node_modules\cnpm\node_modules\runscript\index.js:96:21)
    at ChildProcess.emit (events.js:314:20)
    at maybeClose (internal/child_process.js:1047:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
npminstall version: 3.28.0
npminstall args: C:\Program Files\nodejs\node.exe C:\Users\Wang\AppData\Roaming\npm\node_modules\cnpm\node_modules\npminstall\bin\install.js --fix-bug-versions --china --userconfig=C:\Users\Wang\.cnpmrc --disturl=https://npm.taobao.org/mirrors/node --registry=https://r.npm.taobao.org

最佳答案

报错信息不是说了吗....

Please make sure you are using a supported platform and node version. If you
would like to compile fibers on this machine please make sure you have setup your
build environment--
Windows + OS X instructions here: https://github.com/nodejs/nod...
Ubuntu users please run: sudo apt-get install g++ build-essential
RHEL users please run: yum install gcc-c++ and yum groupinstall 'Development Tools'
Alpine users please run: sudo apk add python make g++

你安装的这个npm包 fibers, 需要使用 node-gyp 这个工具编译成 Node.js addon, 所以你需要一些编译工具和套件. 大概就是 C++ 编译环境Python 吧. 具体的可以看一下文档