所以我試圖從我的專案(package.json)安裝我的 npm 包。
(該包是通過 git pull 從我的 github 倉庫中提取的)
但是當我嘗試運行時npm i,出現以下錯誤:
資訊:
- Linux Debian 10
- 節點 v17.5.0
- npm 8.4.1
完全錯誤:
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 discord-api-types@0.26.1: No longer supported. Install the latest release!
npm ERR! code 1
npm ERR! git dep preparation failed
npm ERR! command /usr/bin/node /usr/lib/node_modules/npm/bin/npm-cli.js install --force --cache=/home/vara/.npm --prefer-offline=false --prefer-online=false --offline=false --no-progress --no-save --no-audit --include=dev --include=peer --include=optional --no-package-lock-only --no-dry-run
npm ERR! npm WARN using --force Recommended protections disabled.
npm ERR! npm WARN old lockfile
npm ERR! npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm ERR! npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm ERR! npm WARN old lockfile
npm ERR! npm WARN old lockfile This is a one-time fix-up, please be patient...
npm ERR! npm WARN old lockfile
npm ERR! npm WARN deprecated ini@1.3.5: Please update to ini >=1.3.6 to avoid a prototype pollution issue
npm ERR! npm WARN deprecated os-homedir@2.0.0: This is not needed anymore. Use `require('os').homedir()` instead.
npm ERR! npm WARN deprecated flatten@1.0.2: flatten is deprecated in favor of utility frameworks such as lodash.
npm ERR! npm WARN deprecated rollup-plugin-buble@0.19.8: This module has been deprecated and is no longer maintained. Please use @rollup/plugin-buble.
npm ERR! npm WARN deprecated rollup-plugin-alias@1.5.2: This module has moved and is now available at @rollup/plugin-alias. Please update your dependencies. This version is no longer maintained.
npm ERR! npm WARN deprecated browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm ERR! npm WARN deprecated rollup-plugin-json@3.1.0: This module has been deprecated and is no longer maintained. Please use @rollup/plugin-json.
npm ERR! npm WARN deprecated rollup-plugin-node-resolve@4.2.4: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-node-resolve.
npm ERR! npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm ERR! npm WARN deprecated rollup-plugin-babel@4.3.3: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-babel.
npm ERR! npm WARN deprecated mkdirp@0.5.1: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm ERR! npm WARN deprecated rollup-plugin-commonjs@9.3.4: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-commonjs.
npm ERR! npm WARN deprecated @babel/polyfill@7.4.4: ?? This package has been deprecated in favor of separate inclusion of a polyfill and regenerator-runtime (when needed). See the @babel/polyfill docs (https://babeljs.io/docs/en/babel-polyfill) for more information.
npm ERR! npm WARN deprecated svgo@0.7.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
npm ERR! npm WARN deprecated svgo@1.3.0: This SVGO version is no longer supported. Upgrade to v2.x.x.
npm ERR! npm WARN deprecated iltorb@2.4.3: The zlib module provides APIs for brotli compression/decompression starting with Node.js v10.16.0, please use it over iltorb
npm ERR! npm WARN deprecated core-js@2.6.9: core-js@<3.4 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! npm ERR! code 1
npm ERR! npm ERR! path /home/vara/.npm/_cacache/tmp/git-clonejK1p2j/node_modules/iltorb
npm ERR! npm ERR! command failed
npm ERR! npm ERR! command sh -c node ./scripts/install.js || node-gyp rebuild
npm ERR! npm ERR! make: Entering directory '/home/vara/.npm/_cacache/tmp/git-clonejK1p2j/node_modules/iltorb/build'
npm ERR! npm ERR! CC(target) Release/obj.target/iltorb/brotli/c/common/dictionary.o
npm ERR! npm ERR! CC(target) Release/obj.target/iltorb/brotli/c/common/transform.o
npm ERR! npm ERR! CC(target) Release/obj.target/iltorb/brotli/c/dec/bit_reader.o
npm ERR! npm ERR! CC(target) Release/obj.target/iltorb/brotli/c/dec/decode.o
npm ERR! npm ERR! CC(target) Release/obj.target/iltorb/brotli/c/dec/huffman.o
npm ERR! npm ERR! CC(target) Release/obj.target/iltorb/brotli/c/dec/state.o
npm ERR! npm ERR! CC(target) Release/obj.target/iltorb/brotli/c/enc/backward_references.o
npm ERR! npm ERR! CC(target) Release/obj.target/iltorb/brotli/c/enc/backward_references_hq.o
npm ERR! npm ERR! CC(target) Release/obj.target/iltorb/brotli/c/enc/bit_cost.o
npm ERR! npm ERR! CC(target) Release/obj.target/iltorb/brotli/c/enc/block_splitter.o
npm ERR! npm ERR! CC(target) Release/obj.target/iltorb/brotli/c/enc/brotli_bit_stream.o
npm ERR! npm ERR! CC(target) Release/obj.target/iltorb/brotli/c/enc/cluster.o
npm ERR! npm ERR! CC(target) Release/obj.target/iltorb/brotli/c/enc/compress_fragment.o
npm ERR! npm ERR! CC(target) Release/obj.target/iltorb/brotli/c/enc/compress_fragment_two_pass.o
npm ERR! npm ERR! CC(target) Release/obj.target/iltorb/brotli/c/enc/dictionary_hash.o
npm ERR! npm ERR! CC(target) Release/obj.target/iltorb/brotli/c/enc/encode.o
npm ERR! npm ERR! CC(target) Release/obj.target/iltorb/brotli/c/enc/encoder_dict.o
npm ERR! npm ERR! CC(target) Release/obj.target/iltorb/brotli/c/enc/entropy_encode.o
npm ERR! npm ERR! CC(target) Release/obj.target/iltorb/brotli/c/enc/histogram.o
npm ERR! npm ERR! CC(target) Release/obj.target/iltorb/brotli/c/enc/literal_cost.o
npm ERR! npm ERR! CC(target) Release/obj.target/iltorb/brotli/c/enc/memory.o
npm ERR! npm ERR! CC(target) Release/obj.target/iltorb/brotli/c/enc/metablock.o
npm ERR! npm ERR! CC(target) Release/obj.target/iltorb/brotli/c/enc/static_dict.o
npm ERR! npm ERR! CC(target) Release/obj.target/iltorb/brotli/c/enc/utf8_util.o
npm ERR! npm ERR! CXX(target) Release/obj.target/iltorb/src/common/allocator.o
npm ERR! npm ERR! make: Leaving directory '/home/vara/.npm/_cacache/tmp/git-clonejK1p2j/node_modules/iltorb/build'
npm ERR! npm ERR! info install installing standalone, skipping download.
npm ERR! npm ERR! gyp info it worked if it ends with ok
npm ERR! npm ERR! gyp info using node-gyp@8.4.1
npm ERR! npm ERR! gyp info using node@17.5.0 | linux | x64
npm ERR! npm ERR! gyp info find Python using Python version 3.7.3 found at "/usr/bin/python3"
npm ERR! npm ERR! gyp info spawn /usr/bin/python3
npm ERR! npm ERR! gyp info spawn args [
npm ERR! npm ERR! gyp info spawn args '/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! npm ERR! gyp info spawn args '-f',
npm ERR! npm ERR! gyp info spawn args 'make',
npm ERR! npm ERR! gyp info spawn args '-I',
npm ERR! npm ERR! gyp info spawn args '/home/vara/.npm/_cacache/tmp/git-clonejK1p2j/node_modules/iltorb/build/config.gypi',
npm ERR! npm ERR! gyp info spawn args '-I',
npm ERR! npm ERR! gyp info spawn args '/usr/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! npm ERR! gyp info spawn args '-I',
npm ERR! npm ERR! gyp info spawn args '/home/vara/.cache/node-gyp/17.5.0/include/node/common.gypi',
npm ERR! npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! npm ERR! gyp info spawn args '-Dnode_root_dir=/home/vara/.cache/node-gyp/17.5.0',
npm ERR! npm ERR! gyp info spawn args '-Dnode_gyp_dir=/usr/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! npm ERR! gyp info spawn args '-Dnode_lib_file=/home/vara/.cache/node-gyp/17.5.0/<(target_arch)/node.lib',
npm ERR! npm ERR! gyp info spawn args '-Dmodule_root_dir=/home/vara/.npm/_cacache/tmp/git-clonejK1p2j/node_modules/iltorb',
npm ERR! npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! npm ERR! gyp info spawn args '--depth=.',
npm ERR! npm ERR! gyp info spawn args '--no-parallel',
npm ERR! npm ERR! gyp info spawn args '--generator-output',
npm ERR! npm ERR! gyp info spawn args 'build',
npm ERR! npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! npm ERR! gyp info spawn args ]
npm ERR! npm ERR! gyp info spawn make
npm ERR! npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! npm ERR! In file included from ../src/common/allocator.cc:1:
npm ERR! npm ERR! ../../nan/nan.h: In function ‘void Nan::AsyncQueueWorker(Nan::AsyncWorker*)’:
npm ERR! npm ERR! ../../nan/nan.h:2298:62: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
npm ERR! npm ERR! , reinterpret_cast<uv_after_work_cb>(AsyncExecuteComplete)
npm ERR! npm ERR! ^
npm ERR! npm ERR! In file included from ../../nan/nan.h:2884,
npm ERR! npm ERR! from ../src/common/allocator.cc:1:
npm ERR! npm ERR! ../../nan/nan_typedarray_contents.h: In constructor ‘Nan::TypedArrayContents<T>::TypedArrayContents(v8::Local<v8::Value>)’:
npm ERR! npm ERR! ../../nan/nan_typedarray_contents.h:34:43: error: ‘class v8::ArrayBuffer’ has no member named ‘GetContents’; did you mean ‘IsContext’?
npm ERR! npm ERR! data = static_cast<char*>(buffer->GetContents().Data()) byte_offset;
npm ERR! npm ERR! ^~~~~~~~~~~
npm ERR! npm ERR! IsContext
npm ERR! npm ERR! make: *** [iltorb.target.mk:149: Release/obj.target/iltorb/src/common/allocator.o] Error 1
npm ERR! npm ERR! gyp ERR! build error
npm ERR! npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! npm ERR! gyp ERR! stack at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
npm ERR! npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:526:28)
npm ERR! npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! npm ERR! gyp ERR! System Linux 3.10.0-1160.21.1.vz7.174.4
npm ERR! npm ERR! gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! npm ERR! gyp ERR! cwd /home/vara/.npm/_cacache/tmp/git-clonejK1p2j/node_modules/iltorb
npm ERR! npm ERR! gyp ERR! node -v v17.5.0
npm ERR! npm ERR! gyp ERR! node-gyp -v v8.4.1
npm ERR! npm ERR! gyp ERR! not ok
npm ERR!
npm ERR! npm ERR! A complete log of this run can be found in:
npm ERR! npm ERR! /home/vara/.npm/_logs/2022-02-18T13_31_09_386Z-debug-0.log
npm ERR! A complete log of this run can be found in:
npm ERR! /home/vara/.npm/_logs/2022-02-18T13_30_52_454Z-debug-0.log
包.json
"name": "vara",
"version": "1.0.0",
"description": "",
"main": "bot.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"axios": "^0.24.0",
"canvas": "^2.8.0",
"colorthief": "^2.3.2",
"discord.js": "^13.5.1",
"dotenv": "^10.0.0",
"gifencoder": "^2.0.1",
"is-image-url": "^1.1.8",
"moment": "^2.29.1",
"moment-duration-format": "^2.3.2",
"mongoose": "^6.1.6",
"node-canvas-with-twemoji-and-discord-emoji": "^1.2.1",
"string-toolkit": "^1.5.0",
"table": "^6.7.5",
"topgg-autoposter": "^2.0.1",
"twemoji-parser": "^13.1.0"
}
}
已經嘗試過:
- 重新安裝 nodejs & npm
- 更新 nodejs 和 npm
- 洗掉 package-lock.json
非常感謝您的閱讀!
也許有人知道解決這個問題的方法。
uj5u.com熱心網友回復:
當您使用節點版本 17 時,我可以看到這個問題發生了,
降級到節點版本 16 將解決問題(使用 nvm):
nvm install 16
nvm use 16
npm install
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/428350.html
上一篇:package.json中依賴部分的“npm:”前綴是什么意思?
下一篇:反應渲染不顯示任何東西
