我刚刚在运行Ubuntu20.04的WSL上启动了一个Nuxt项目。
我正在使用Nuxt /Fermium,并为项目安装了一些依赖项,但当我尝试安装Node.js本身时,它检索到一些错误,并且我找不到原因:
因此,当我执行npm install nuxt时,会出现以下错误:
Debugger attached.
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated babel-eslint@10.1.0: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.
npm WARN deprecated core-js@2.6.12: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
npm WARN deprecated core-js@2.6.12: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
npm ERR! code 1
npm ERR! path /home/tino/frontend/hanja/node_modules/deasync
npm ERR! command failed
npm ERR! command sh -c node ./build.js
npm ERR! Debugger attached.
npm ERR! Debugger attached.
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@7.1.2
npm ERR! gyp info using node@16.3.0 | linux | x64
npm ERR! gyp info find Python using Python version 3.8.5 found at "/usr/bin/python3"
npm ERR! (node:5914) [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 /usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/home/tino/frontend/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 'make',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/home/tino/frontend/hanja/node_modules/deasync/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/home/tino/frontend/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/home/tino/.cache/node-gyp/16.3.0/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=/home/tino/.cache/node-gyp/16.3.0',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/home/tino/frontend/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/home/tino/.cache/node-gyp/16.3.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/home/tino/frontend/hanja/node_modules/deasync',
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 'build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! Debugger attached.
npm ERR! Waiting for the debugger to disconnect...
npm ERR! gyp: Call to 'node -p "require('node-addon-api').include"' returned exit status 0 while in binding.gyp. while trying to load binding.gyp
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 (/home/tino/frontend/node_modules/node-gyp/lib/configure.js:351:16)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:394:28)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
npm ERR! gyp ERR! System Linux 5.4.72-microsoft-standard-WSL2
npm ERR! gyp ERR! command "/home/tino/.nvm/versions/node/v16.3.0/bin/node" "/home/tino/frontend/node_modules/.bin/node-gyp" "rebuild"
npm ERR! gyp ERR! cwd /home/tino/frontend/hanja/node_modules/deasync
npm ERR! gyp ERR! node -v v16.3.0
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok
npm ERR! Waiting for the debugger to disconnect...
npm ERR! Build failed
npm ERR! Waiting for the debugger to disconnect...
npm ERR! A complete log of this run can be found in:
npm ERR! /home/tino/.npm/_logs/2021-06-22T15_14_10_385Z-debug.log
Waiting for the debugger to disconnect...我刚开始学习Nuxt,但我不知道是什么导致了这个错误。
发布于 2021-06-23 19:21:01
我最终意识到我必须在Ubuntu中安装build-essential包,这会触发错误:
sudo apt-get install build-essential
在那之后,我可以安装Nuxt了,到目前为止,一切都运行得很好!
https://stackoverflow.com/questions/68086348
复制相似问题