简体   繁体   English

分叉的 VueJS 应用程序在 npm 安装时出错

[英]Forked VueJS app gives error on npm install

So this company gave me the assignment to build a simple Vue app.所以这家公司给我的任务是构建一个简单的 Vue 应用程序。 I forked code from their repo and tried to run npm install .我从他们的 repo 中分叉代码并尝试运行npm install But It gave me couple errors that is in this log file .但是它给了我这个日志文件中的几个错误。 Also here is my package.json file:这也是我的package.json文件:

{
  "name": "todo-app",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "test:unit": "vue-cli-service test:unit",
    "lint": "vue-cli-service lint"
  },
  "dependencies": {
    "axios": "^0.21.1",
    "core-js": "^3.6.5",
    "vue": "^3.0.0",
    "vue-router": "^4.0.0-0",
    "vuex": "^4.0.0-0"
  },
  "devDependencies": {
    "@vue/cli-plugin-babel": "~4.5.0",
    "@vue/cli-plugin-eslint": "~4.5.0",
    "@vue/cli-plugin-router": "~4.5.0",
    "@vue/cli-plugin-unit-jest": "~4.5.0",
    "@vue/cli-plugin-vuex": "~4.5.0",
    "@vue/cli-service": "~4.5.0",
    "@vue/compiler-sfc": "^3.0.0",
    "@vue/test-utils": "^2.0.0-0",
    "autoprefixer": "^9.8.6",
    "babel-eslint": "^10.1.0",
    "eslint": "^6.7.2",
    "eslint-plugin-vue": "^7.0.0",
    "jest-transform-stub": "^2.0.0",
    "node-sass": "^4.12.0",
    "postcss": "^7.0.36",
    "sass-loader": "^8.0.2",
    "tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.2.7",
    "typescript": "~3.9.3",
    "vue-jest": "^5.0.0-0"
  }
}

Here are couple extra information if those are necessary:如果需要,这里有一些额外的信息:

  • npm version: 7.21.1 npm版本: 7.21.1
  • @vue/cli version: 4.5.13 @vue/cli版本: 4.5.13
  • Node version: 16.0.0 Node版本: 16.0.0

Part of error部分错误

5827 verbose stack Error: command failed
5827 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/index.js:64:27)
5827 verbose stack     at ChildProcess.emit (node:events:365:28)
5827 verbose stack     at maybeClose (node:internal/child_process:1067:16)
5827 verbose stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
5828 verbose pkgid node-sass@4.5.3
5829 verbose cwd /home/yarkin/Documents/WEB/VueJS/todo-app
5830 verbose Linux 5.11.0-37-generic
5831 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--saveDev" "node-sass@4.5.3"
5832 verbose node v16.0.0
5833 verbose npm  v7.21.1
5834 error code 1
5835 error path /home/yarkin/Documents/WEB/VueJS/todo-app/node_modules/node-sass
5836 error command failed
5837 error command sh -c node scripts/build.js
5838 error Building: /usr/local/bin/node /home/yarkin/Documents/WEB/VueJS/todo-app/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=

The problem is specific to node-sass , in this project it seems to be the only binary dependency that depends on a platform and Node version.该问题特定于node-sass ,在该项目中,它似乎是唯一依赖于平台和 Node 版本的二进制依赖项。

There is a message that lock file version is old, this means that it was created with another version of NPM (v6), this can be is a possible source of problems due to differences in resolved dependencies.有一条消息说锁文件版本是旧的,这意味着它是用另一个版本 NPM (v6) 创建的,这可能是由于解决的依赖关系不同而导致的问题的可能来源。

As the documentation lists, different node-sass versions are linked to different Node versions, "node-sass": "^4.12.0" suggests that the project is supposed to run with Node v12, while v16 was used.正如 文档所列,不同node-sass版本链接到不同的 Node 版本, "node-sass": "^4.12.0"表明该项目应该使用 Node v12 运行,而使用的是 v16。

Possible solutions are:可能的解决方案是:

  • Switch to Node v12 for this project (can be too old for other ones) and run as is为这个项目切换到 Node v12(对于其他项目来说可能太旧了)并按原样运行

  • Switch to Node v14 (the latest LTS release, less problems in general) and update node-sass to ^4.14切换到 Node v14(最新的 LTS 版本,一般问题较少)并将node-sass更新到^4.14

  • Stay with Node v16 and update node-sass to ^6.0继续使用 Node v16 并将node-sass更新到^6.0

  • Stay with Node v16, remove node-sass , instead add platform-independent sass , follow migration guidelines for Dart Sass if problems arise (primarily / syntax)继续使用 Node v16,删除node-sass ,而不是添加平台无关的sass ,如果出现问题(主要是/语法),请遵循 Dart Sass 的迁移指南

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM