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

发布于 2022-09-12 13:31:15 字数 4966 浏览 20 评论 0

D:\wwwroot\discuz7\resources\frame>cnpm install
- [28/70] Installing imurmurhash@^0.1.4platform unsupported babel-loader@7.1.5 › webpack@4.44.2 › watchpack@1.7.5 › chokidar@3.4.3 › fsevents@~2.1.2 Package require os(darwin) not compatible with your platform(win32)
platform unsupported babel-loader@7.1.5 › webpack@4.44.2 › watchpack@1.7.5 › watchpack-chokidar2@2.0.1 › chokidar@2.1.8 › 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 babel-plugin-transform-es2015-modules-commonjs@6.26.2 › babel-runtime@6.26.0 › core-js@^2.4.0 run "node -e \"try{require('./postinstall')}catch(e){}\"", root: "D:\\wwwroot\\discuz7\\resources\\frame\\node_modules\\_core-js@2.6.12@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 babel-plugin-transform-es2015-modules-commonjs@6.26.2 › babel-runtime@6.26.0 › 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\\_fibers@4.0.3@fibers"

D:\wwwroot\discuz7\resources\frame\node_modules\_fibers@4.0.3@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 "<string>", 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\_fibers@4.0.3@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.<anonymous> (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.<anonymous> (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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夕色琉璃 2022-09-19 13:31:15

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

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 吧. 具体的可以看一下文档

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文