npm安装给出错误:[节点版本:16.2.0和npm版本:7.13.0]



使用的命令:sudo npm install我正试图在特定文件夹中执行此命令。

package.json文件如下所示:

"dependencies": {
"@branu-jp/v-drag": "^0.1.0",
"axios": "^0.21.0",
"bootstrap": "^4.5.3",
"bootstrap-icons": "^1.1.0",
"core-js": "^3.6.5",
"jquery": "^3.6.0",
"moment": "^2.29.1",
"npm-upgrade": "^2.0.4",
"popper.js": "^1.16.1",
"video.js": "^7.10.2",
"vue": "^2.6.11",
"vue-cookies": "^1.7.4",
"vue-meta": "^2.4.0",
"vue-multiselect": "^2.1.6",
"vue-pagination-2": "^3.0.8",
"vue-toastification": "^1.7.8",
"vue2-datepicker": "^3.8.2",
"vuejs-paginate": "^2.1.0",
"vuetify": "^2.3.21",
"vuex": "^3.6.0"
},
"devDependencies": {
"@types/jquery": "^3.5.5",
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"babel-eslint": "^10.1.0",
"eslint": "^6.8.0",
"eslint-plugin-vue": "^6.2.2",
"node-sass": "^5.0.0",
"sass-loader": "^10.1.0",
"vue-loader-v16": "npm:vue-loader@^16.1.1",
"vue-template-compiler": "^2.6.11"
}

我已经包含了日志文件中提到错误的部分内容。日志为:

8700 timing build:run:postinstall:node_modules/core-js Completed in 275ms
8701 info run node-sass@5.0.0 postinstall { code: 1, signal: null }
8702 timing reify:rollback:createSparse Completed in 5415ms
8703 timing reify:rollback:retireShallow Completed in 0ms
8704 timing command:install Completed in 497508ms
8705 verbose stack Error: command failed
8705 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/index.js:64:27)
8705 verbose stack     at ChildProcess.emit (node:events:365:28)
8705 verbose stack     at maybeClose (node:internal/child_process:1067:16)
8705 verbose stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
8706 verbose pkgid node-sass@5.0.0
8707 verbose cwd /home/mediaworker/damWebWorkPlace/damweb
8708 verbose Linux 5.4.0-73-generic
8709 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
8710 verbose node v16.2.0
8711 verbose npm  v7.13.0
8712 error code 1
8713 error path /home/mediaworker/damWebWorkPlace/damweb/node_modules/node-sass
8714 error command failed
8715 error command sh -c node scripts/build.js
8716 error Building: /usr/local/bin/node /home/mediaworker/damWebWorkPlace/damweb/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=

我已经包含了日志文件中提到错误的部分内容。

8717 error gyp verb find Python Python is not set from command line or npm configuration
8717 error gyp verb find Python Python is not set from environment variable PYTHON
8717 error gyp verb find Python checking if "python3" can be used
8717 error gyp verb find Python - executing "python3" to get executable path
8717 error gyp verb find Python - executable path is "/usr/bin/python3"
8717 error gyp verb find Python - executing "/usr/bin/python3" to get version
8717 error gyp verb find Python - version is "3.8.5"
8717 error gyp info find Python using Python version 3.8.5 found at "/usr/bin/python3"
8717 error gyp verb get node dir no --target version specified, falling back to host node version: 16.2.0
8717 error gyp verb command install [ '16.2.0' ]
8717 error gyp verb install input version string "16.2.0"
8717 error gyp verb install installing version: 16.2.0
8717 error gyp verb install --ensure was passed, so won't reinstall if already installed
8717 error gyp WARN EACCES current user ("mediaworker") does not have permission to access the dev dir "/root/.cache/node-gyp/16.2.0"
8717 error gyp WARN EACCES attempting to reinstall using temporary dev dir "/tmp/.node-gyp"
8717 error gyp verb command install [ '--node_gyp_internal_noretry', '16.2.0' ]
8717 error gyp verb install input version string "16.2.0"
8717 error gyp verb install installing version: 16.2.0
8717 error gyp verb install --ensure was passed, so won't reinstall if already installed
8717 error gyp verb install version not already installed, continuing with install 16.2.0
8717 error gyp verb ensuring nodedir is created /tmp/.node-gyp/16.2.0
8717 error gyp verb created nodedir /tmp/.node-gyp

我已经包含了日志文件中提到错误的部分内容。

8717 error make: *** [binding.target.mk:133: Release/obj.target/binding/src/binding.o] Error 1
8717 error gyp ERR! build error
8717 error gyp ERR! stack Error: `make` failed with exit code: 2
8717 error gyp ERR! stack     at ChildProcess.onExit (/home/mediaworker/damWebWorkPlace/damweb/node_modules/node-gyp/lib/build.js:194:23)
8717 error gyp ERR! stack     at ChildProcess.emit (node:events:365:28)
8717 error gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
8717 error gyp ERR! System Linux 5.4.0-73-generic
8717 error gyp ERR! command "/usr/local/bin/node" "/home/mediaworker/damWebWorkPlace/damweb/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
8717 error gyp ERR! cwd /home/mediaworker/damWebWorkPlace/damweb/node_modules/node-sass
8717 error gyp ERR! node -v v16.2.0
8717 error gyp ERR! node-gyp -v v7.1.2
8717 error gyp ERR! not ok
8717 error Build failed with error code: 1
8718 verbose exit 1

我已经包含了日志文件中提到错误的部分内容。任何帮助都足够了。谢谢

在这个问题上花了很长时间之后,对我们有效的解决方案是"节点sass";尚未与节点v16兼容。因此,在将节点版本从v16降级到v14,并将npm从v7降级到v6之后,它起了作用。

最新更新