npm install 时遇到这样问题?

PS C:\Users\Administrator\Desktop\xh\camp-layout-web> npm install

> fibers@4.0.3 install C:\Users\Administrator\Desktop\xh\camp-layout-web\node_modules\fibers
> node build.js || nodejs build.js


C:\Users\Administrator\Desktop\xh\camp-layout-web\node_modules\fibers>if not defined npm_config_node_gyp (node "C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild --release )  else (node "C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild --release )
在此解决方案中一次生成一个项目。若要启用并行生成,请添加“/m”开关。
  fibers.cc
  coroutine.cc
  win_delay_load_hook.cc
c:\users\administrator\desktop\xh\camp-layout-web\node_modules\fibers\src\coroutine.cc(153): warning C4552: ”!“: 未使用表达式结果 [C:\Users\Administrator\Desktop\xh\camp-layout-web\node_modules\fibers\build\fibers.vcxproj]
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
gyp ERR! System Windows_NT 10.0.19041
gyp ERR! command "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--release"
gyp ERR! cwd C:\Users\Administrator\Desktop\xh\camp-layout-web\node_modules\fibers
gyp ERR! node -v v14.15.4
gyp ERR! node-gyp -v v5.1.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' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
npm WARN @typescript-eslint/eslint-plugin@1.13.0 requires a peer of eslint@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @typescript-eslint/parser@1.13.0 requires a peer of eslint@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules\fork-ts-checker-webpack-plugin\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"ia32"})
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":"ia32"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! fibers@4.0.3 install: `node build.js || nodejs build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the fibers@4.0.3 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2021-01-09T02_44_05_081Z-debug.log

 

来自 chatgpt
这个问题是由于您缺少构建环境所需的工具和依赖项导致的。 从错误消息中可以看出,尝试在Windows上重新构建模块,但是缺少构建工具。

要解决这个问题,请按照以下步骤进行操作:

安装所需的构建工具。 根据您的操作系统,您需要安装不同的工具:

Windows: 安装 Visual Studio build tools(https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019%EF%BC%89%E3%80%82
macOS: 安装 Xcode(https://developer.apple.com/xcode/%EF%BC%89%E3%80%82
Linux: 安装 build-essential 包。
升级您的 Node.js 版本。 这可能有助于解决与版本不兼容的问题。

清理 npm 缓存。 可以尝试运行以下命令:

css
Copy code
npm cache clean --force
删除项目的 node_modules 文件夹,然后重新运行 npm install。

如果您已经尝试了上述所有步骤,但仍然遇到问题,请参阅错误消息中提供的其他日志以获取更多信息。