我下载了一个项目,它没有package-lock.json file.When,我运行npm install,有冲突。错误消息:
root@fb3391c63c7f:/app/avatar/avatar-h5# npm install --registry=https://registry.npm.taobao.org
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: avatar@3.2.0
npm ERR! Found: vue@2.6.10
npm ERR! node_modules/vue
npm ERR! vue@"2.6.10" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer vue@"3.0.5" from @vue/compiler-sfc@3.0.5
npm ERR! node_modules/@vue/compiler-sfc
npm ERR! peer @vue/compiler-sfc@"^3.0.0-beta.14" from @vue/cli-service@4.5.10
npm ERR! node_modules/@vue/cli-service
npm ERR! peer @vue/cli-service@"^3.0.0 || ^4.0.0-0" from @vue/cli-plugin-babel@4.4.4
npm ERR! node_modules/@vue/cli-plugin-babel
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /root/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-01-18T21_53_07_044Z-debug.log我阅读了很多文档,认为@vue/cli-plugin-babel@4.4.4将安装最新的@vue/cli-service@4.5.10。如何安装与vue@2.6.10兼容的软件
package.json文件
{
"name": "avatar",
"version": "3.2.0",
"scripts": {
"dev": "vue-cli-service serve",
"build:prod": "vue-cli-service build",
"build:stage": "vue-cli-service build --mode staging",
"preview": "node build/index.js --preview",
"lint": "eslint --ext .js,.vue src",
"test:unit": "jest --clearCache && vue-cli-service test:unit",
"test:ci": "npm run lint && npm run test:unit",
"svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml",
"new": "plop"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"src/**/*.{js,vue}": [
"eslint --fix",
"git add"
]
},
"keywords": [
"vue",
"admin",
"dashboard",
"element-ui",
"boilerplate",
"admin-template",
"management-system"
],
"repository": {
"type": "git",
"url": "https://gitee.com/fairyfleet/avatar.git"
},
"dependencies": {
"@riophae/vue-treeselect": "0.4.0",
"axios": "0.18.1",
"clipboard": "2.0.4",
"core-js": "3.6.5",
"echarts": "4.2.1",
"element-ui": "2.13.2",
"file-saver": "2.0.1",
"js-beautify": "1.10.2",
"fuse.js": "3.4.4",
"js-cookie": "2.2.0",
"jsencrypt": "3.0.0-rc.1",
"normalize.css": "7.0.0",
"nprogress": "0.2.0",
"path-to-regexp": "2.4.0",
"screenfull": "4.2.0",
"sortablejs": "1.8.4",
"vue": "2.6.10",
"vue-count-to": "1.0.13",
"quill": "1.3.7",
"vue-cropper": "0.4.9",
"vue-router": "3.0.2",
"vue-splitpane": "1.0.4",
"vuedraggable": "2.20.0",
"vuex": "3.1.0"
},
"devDependencies": {
"@vue/cli-plugin-babel": "4.4.4",
"@vue/cli-plugin-eslint": "4.4.4",
"@vue/cli-plugin-unit-jest": "4.4.4",
"@vue/cli-service": "4.4.4",
"@vue/test-utils": "1.0.0-beta.29",
"autoprefixer": "9.5.1",
"babel-eslint": "10.1.0",
"babel-jest": "23.6.0",
"babel-plugin-dynamic-import-node": "2.3.3",
"chalk": "2.4.2",
"chokidar": "2.1.5",
"connect": "3.6.6",
"eslint": "6.7.2",
"eslint-plugin-vue": "6.2.2",
"html-webpack-plugin": "3.2.0",
"husky": "1.3.1",
"lint-staged": "8.1.5",
"mockjs": "1.0.1-beta3",
"plop": "2.3.0",
"runjs": "4.3.2",
"node-sass": "4.14.1",
"sass-loader": "8.0.2",
"script-ext-html-webpack-plugin": "2.1.3",
"script-loader": "0.7.2",
"serve-static": "1.13.2",
"svg-sprite-loader": "4.1.3",
"svgo": "1.2.0",
"vue-template-compiler": "2.6.10"
},
"engines": {
"node": ">=8.9",
"npm": ">= 3.0.0"
},
"browserslist": [
"> 1%",
"last 2 versions"
]
}发布于 2021-02-04 17:44:07
这里也有同样的问题。它只出现在较新版本的npm上。您可以通过回退到NodeJS的LTS14.15版本来暂时修复它。
在Linux/MacOS上:
nvm use --lts否则:
npm install -g npm@6.14.8发布于 2021-03-17 11:41:43
对我来说,修复这个问题的方法是删除node_modules文件夹,然后将包版本粘贴到包json文件中,然后运行npm install。
发布于 2021-10-13 23:02:30
添加到Chaim Zonnenberg的步骤
在使用节点(16.11.1)和npm (8.0.0)在macOS上处理NestJS项目时,我遇到了此错误。
当我运行命令npm install时,我得到以下错误:
npm WARN old lockfile
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: admin-gateway@0.0.1
npm ERR! Found: rxjs@7.3.0
npm ERR! node_modules/rxjs
npm ERR! rxjs@"^6.0.0" from the root project
npm ERR! peer rxjs@"^6.0.0 || ^7.0.0" from @nestjs/axios@0.0.1
npm ERR! node_modules/@nestjs/axios
npm ERR! @nestjs/axios@"^0.0.1" from the root project
npm ERR! 4 more (@nestjs/common, @nestjs/core, @nestjs/config, @nestjs/microservices)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! elastic-apm-nest@"0.0.7" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: rxjs@6.6.7
npm ERR! node_modules/rxjs
npm ERR! peer rxjs@"^6.0.0" from elastic-apm-nest@0.0.7
npm ERR! node_modules/elastic-apm-nest
npm ERR! elastic-apm-nest@"0.0.7" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.这里是我如何修复它的
问题是我运行的是较新版本的lts (16.11.1),它不是长期支持()版本。
首先,我使用homebrew命令删除了macOS上的node包:
brew uninstall --ignore-dependencies node 然后我使用homebrew安装了nvm
brew install nvm接下来,我创建了NVM的工作目录,因为它不存在:
mkdir ~/.nvm接下来,我将以下内容添加到~/.zshrc文件或所需的shell配置文件中。对于我来说,~/.zshrc文件不存在,所以我使用命令touch ~/.zshrc创建了它,然后使用以下命令打开它:
nano ~/.zshrc并添加了以下内容:
export NVM_DIR="$HOME/.nvm"
[ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh" # This loads nvm
[ -s "/usr/local/opt/nvm/etc/bash_completion.d/nvm" ] && . "/usr/local/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion使用组合键Ctrl + X,然后按Y和ENTER保存文件
接下来,打开一个新的终端,使用以下命令安装Node LTS版本:
nvm install --lts如果您已经安装了节点LTS版本,则运行以下命令:
nvm use --lts使用以下命令确认您的Node和npm版本:
node --version
npm --version最后,再次运行npm install命令,这次一切都会正常进行。
这都是
https://stackoverflow.com/questions/65783437
复制相似问题