簡體   English   中英

npm 安裝出現錯誤:[節點版本:16.2.0 和 npm 版本:7.13.0]

[英]npm install giving errors : [node version : 16.2.0 and npm version : 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

我已經包含了部分日志文件,其中提到了錯誤。 任何幫助就足夠了。 謝謝。

在這個問題上花費了相當長的時間后,對我們有用的解決方案是“node-sass”還與 node v16 不兼容 因此,在將節點版本從 v16 降級到 v14 並將 npm 從 v7 降級到 v6 之后,它可以工作。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM