TT-knight 2022-01-02 22:59 采纳率: 50%
浏览 742
已结题

npm install报错 node-gyp

npm install遇到这种问题怎么解决?
npm WARN old lockfile
npm WARN old lockfile The npm-shrinkwrap.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated node-pre-gyp@0.14.0: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future
npm ERR! code 1
npm ERR! path C:\My Projects\meteor\room-assignment-csop-main\output\bundle\programs\server\node_modules\fibers
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node build.js || nodejs build.js
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@6.0.1
npm ERR! gyp info using node@16.13.1 | win32 | x64
npm ERR! gyp info find Python using Python version 3.10.1 found at "C:\Program Files\Python310\python.exe"
npm ERR! gyp info find VS using VS2017 (15.9.28307.1759) found at:
npm ERR! gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools"
npm ERR! gyp info find VS run with --verbose for detailed information
npm ERR! (node:5088) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
npm ERR! (Use `node --trace-deprecation ...` to show where the warning was created)
npm ERR! gyp info spawn C:\Program Files\Python310\python.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   'C:\\My Projects\\meteor\\room-assignment-csop-main\\output\\bundle\\programs\\server\\node_modules\\node-gyp\\gyp\\gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'msvs',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   'C:\\My Projects\\meteor\\room-assignment-csop-main\\output\\bundle\\programs\\server\\node_modules\\fibers\\build\\config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   'C:\\My Projects\\meteor\\room-assignment-csop-main\\output\\bundle\\programs\\server\\node_modules\\node-gyp\\addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   'C:\\Users\\Administrator\\AppData\\Local\\node-gyp\\Cache\\16.13.1\\include\\node\\common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=C:\\Users\\Administrator\\AppData\\Local\\node-gyp\\Cache\\16.13.1',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=C:\\My Projects\\meteor\\room-assignment-csop-main\\output\\bundle\\programs\\server\\node_modules\\node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\16.13.1\\\\<(target_arch)\\\\node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=C:\\My Projects\\meteor\\room-assignment-csop-main\\output\\bundle\\programs\\server\\node_modules\\fibers',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'C:\\My Projects\\meteor\\room-assignment-csop-main\\output\\bundle\\programs\\server\\node_modules\\fibers\\build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! Traceback (most recent call last):
npm ERR!   File "C:\My Projects\meteor\room-assignment-csop-main\output\bundle\programs\server\node_modules\node-gyp\gyp\gyp_main.py", line 47, in <module>
npm ERR!     import gyp
npm ERR!   File "C:\My Projects\meteor\room-assignment-csop-main\output\bundle\programs\server\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 10, in <module>
npm ERR!     import gyp.input
npm ERR!   File "C:\My Projects\meteor\room-assignment-csop-main\output\bundle\programs\server\node_modules\node-gyp\gyp\pylib\gyp\input.py", line 9, in <module>
npm ERR!     import gyp.common
npm ERR!   File "C:\My Projects\meteor\room-assignment-csop-main\output\bundle\programs\server\node_modules\node-gyp\gyp\pylib\gyp\common.py", line 499, in <module>
npm ERR!     class OrderedSet(collections.MutableSet):
npm ERR! AttributeError: module 'collections' has no attribute 'MutableSet'
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
npm ERR! gyp ERR! stack     at ChildProcess.onCpExit (C:\My Projects\meteor\room-assignment-csop-main\output\bundle\programs\server\node_modules\node-gyp\lib\configure.js:351:16)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
npm ERR! gyp ERR! System Windows_NT 10.0.17763
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\My Projects\\meteor\\room-assignment-csop-main\\output\\bundle\\programs\\server\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--release"
npm ERR! gyp ERR! cwd C:\My Projects\meteor\room-assignment-csop-main\output\bundle\programs\server\node_modules\fibers
npm ERR! gyp ERR! node -v v16.13.1
npm ERR! gyp ERR! node-gyp -v v6.0.1
npm ERR! gyp ERR! not ok
npm ERR! node-gyp exited with code: 1
npm ERR! Please make sure you are using a supported platform and node version. If you
npm ERR! would like to compile fibers on this machine please make sure you have setup your
npm ERR! build environment--
npm ERR! Windows + OS X instructions here: https://github.com/nodejs/node-gyp
npm ERR! Ubuntu users please run: `sudo apt-get install g++ build-essential`
npm ERR! RHEL users please run: `yum install gcc-c++` and `yum groupinstall 'Development Tools'`
npm ERR! Alpine users please run: `sudo apk add python make g++`
npm ERR! 'nodejs' �����ڲ����ⲿ���Ҳ���ǿ����еij���
npm ERR! ���������ļ���

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Administrator\AppData\Local\npm-cache\_logs\2022-01-02T14_29_12_063Z-debug-0.log

已经安装C++和python环境,也试着重装node.js还是一样的错误,用cnpm install也有问题。感觉是node-gyp,试着node npm-rebuild.js
也报错,这bug已经搞了一天了,累死
  • 写回答

1条回答 默认 最新

  • TT-knight 2022-01-03 10:17
    关注

    问题解决了,主要是版本问题导致的,先把一开始的警告解决了后面就没问题了。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

问题事件

  • 系统已结题 1月11日
  • 已采纳回答 1月3日
  • 创建了问题 1月2日

悬赏问题

  • ¥15 php 将rtmp协议转hls协议,无法播放
  • ¥15 miniconda安装不了
  • ¥20 python代码编写
  • ¥20 使用MPI广播数据遇到阻塞
  • ¥15 TinyMCE如何去掉自动弹出的“链接…”工具?
  • ¥15 微信支付转账凭证,如何解决
  • ¥15 在win10下使用指纹登录时,界面上的文字最后一个字产生换行现象
  • ¥20 使用AT89C51微控制器和MAX7219驱动器来实现0到99秒的秒表计数,有开始和暂停以及复位功能,下面有仿真图,请根据仿真图来设计c语言程序
  • ¥15 51单片机 双路ad同步采样
  • ¥15 使用xdocreport 生成word