简体   繁体   English

Git - 克隆 Vue.js 项目并运行

[英]Git - Cloning Vue.js project and run

I have cloned a project from a Git Repo into my Mac, It only has project files not the node modules.我已经从 Git Repo 克隆了一个项目到我的 Mac 中,它只有项目文件,没有节点模块。

In GIT: Readme.md says run npm install to setup the project.在 GIT 中:Readme.md 说运行 npm 安装以设置项目。 When I run the npm install I get below error list, how do I get through it?当我运行 npm 安装时,出现以下错误列表,我该如何解决?

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: @vue/eslint-config-standard@6.1.0
npm ERR! Found: eslint-plugin-vue@8.7.1
npm ERR! node_modules/eslint-plugin-vue
npm ERR!   dev eslint-plugin-vue@"^8.0.3" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer eslint-plugin-vue@"^7.0.0" from @vue/eslint-config-standard@6.1.0
npm ERR! node_modules/@vue/eslint-config-standard
npm ERR!   dev @vue/eslint-config-standard@"^6.1.0" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: eslint-plugin-vue@7.20.0
npm ERR! node_modules/eslint-plugin-vue
npm ERR!   peer eslint-plugin-vue@"^7.0.0" from @vue/eslint-config-standard@6.1.0
npm ERR!   node_modules/@vue/eslint-config-standard
npm ERR!     dev @vue/eslint-config-standard@"^6.1.0" 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.
npm ERR! 
npm ERR! See /Users/dev/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/dev/.npm/_logs/2022-06-23T23_17_06_125Z-debug-0.log

在此处输入图像描述

The first thing you're supposed to do when getting an error is read it all, looking for information which might help you fix it.遇到错误时您应该做的第一件事就是阅读所有内容,寻找可能帮助您修复它的信息。

In this particular case, it's:在这种特殊情况下,它是:

npm ERR! npm 错误! Fix the upstream dependency conflict, or retry修复上游依赖冲突,或者重试
npm ERR! npm 错误! this command with --force, or --legacy-peer-deps此命令与 --force 或 --legacy-peer-deps
npm ERR! npm 错误! to accept an incorrect (and potentially broken) dependency resolution.接受不正确的(并且可能被破坏的)依赖解决方案。


The project you've cloned has a dependency conflict.您克隆的项目存在依赖冲突。 Two packages require different versions of a third package.两个包需要不同版本的第三个包。
A possible fix would be to run npm i --legacy-peer-deps or npm i --force , which will attempt solving the conflict.一个可能的解决方法是运行npm i --legacy-peer-depsnpm i --force ,这将尝试解决冲突。 npm can't solve these conflicts without letting you know, as it's potentially breaking one of the packages requesting the dependency. npm无法在不通知您的情况下解决这些冲突,因为它可能会破坏请求依赖项的包之一。

As a side note, in this particular case it looks like you have too many linter plugins in your eslint config.附带说明一下,在这种特殊情况下,您的 eslint 配置中似乎有太多的 linter 插件。 You only need the most recent one for your vue version.你的 vue 版本只需要最新的一个。

If running with --force or with --legacy-peer-deps doesn't solve the problem, you'll need to show us your eslint config and the relevant section of your package.json如果使用--force--legacy-peer-deps运行不能解决问题,您需要向我们展示您的 eslint 配置和package.json的相关部分

Probably the easiest way would be to create a repository for your project and then create a codesandbox.io from the repo.可能最简单的方法是为您的项目创建一个存储库,然后从该存储库创建一个 codesandbox.io。 Or provide a link to it.或者提供它的链接。

This bug seems current, to reproduce it:这个错误似乎是最新的,重现它:

vue create hello-world
Vue CLI v5.0.8
...
npm install

and if you do: rm -rf node_modules then npm install you get error:如果你这样做: rm -rf node_modules然后npm install你会得到错误:

npm ERR! While resolving: @vue/eslint-config-standard@6.1.0

And no solution till now直到现在都没有解决方案

thank you谢谢你

What I did to get rid of the problem was removing the:我为解决这个问题所做的是删除:

"eslint-plugin-vue": "^8.0.3", "eslint-plugin-vue": "^8.0.3",

line in the package.json file. package.json 文件中的行。 from the "devDependencies" section.来自“devDependencies”部分。

Then I did an然后我做了一个

npm install npm 安装

to download all the dependencies.下载所有依赖项。 And after that I downloaded the eslint Vue plugin seperatly with the Vue CLI.之后,我使用 Vue CLI 单独下载了 eslint Vue 插件。

vue add eslint vue 添加 eslint

I don't know if this is the solution to the problem.我不知道这是否解决问题的方法。 I just wanted to help.我只是想帮忙。

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

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