您的位置:首页 > Web前端

配置使用Eslint的时候 版本错误 "eslint": "5.6.0" a different version of eslint was detected higher up in the tr

2018-11-13 19:21 691 查看

1, 如果你也遇到下面的问题,你可以 按照命令行提示的那样,下面这四步完成的一般就可以了,但是不排除你在运行的时候忘记下载某些依赖。

  • 【1】 删除
    package-lock.json
    (不是
    package.json
    ) 你可以选择
    yarn.lock
    或者不要,我是没有做这步的
  • 【2】删除
    node_modules
    在你的项目文件夹里面的
    node_modules
  • 【3】移除你自己下载的
    eslint
    , 在
    package.json
    里面的
    dependencies 或者 devDependencies
  • 【4】然后再重新
    npm install
    使用
    npm
    存在丢包现象,所以项目中使用
    yarn
    可能会好一点
1. Delete package-lock.json (not package.json!) and/or yarn.lock in your proje         ct folder.
2. Delete node_modules in your project folder.
4. Remove "eslint" from dependencies and/or devDependencies in the package.json file in your project folder.
6. Run npm install or yarn, depending on the package manager you use.

如果上面四步没法完成的话

npm install yarn

之后使用
yarn
代替上面的
npm
执行上面四个步骤。

当然如果刚开始跟我一样大头虾,忘记下载安装各种依赖 例如

npm-install-all
这些的要先记得下载安装

There might be a problem with the project dependency tree.
It is likely not a bug in Create React App, but something you need to fix locall         y.

The react-scripts package provided by Create React App requires a dependency:

"eslint": "5.6.0"

Don't try to install it manually: your package manager does it automatically.
However, a different version of eslint was detected higher up in the tree:

E:\学习文件\React\ticket-app\node_modules\eslint (version: 5.9.0)

Manually installing incompatible versions is known to cause hard-to-debug issues         .

If prefer to ignore this check, add SKIP_PREFLIGHT_CHECK=true to an .env file in          your project.
That will permanently disable this message but you might encounter other issues.

To fix the dependency tree, try following the steps below in the exact order:

1. Delete package-lock.json (not package.json!) and/or yarn.lock in your proje         ct folder.
2. Delete node_modules in your project folder.
3. Remove "eslint" from dependencies and/or devDependencies in the package.jso         n file in your project folder.
4. Run npm install or yarn, depending on the package manager you use.

In most cases, this should be enough to fix the problem.
If this has not helped, there are a few other things you can try:

5. If you used npm, install yarn (http://yarnpkg.com/) and repeat the above st         eps with it instead.
This may help because npm has known issues with package hoisting which may          get resolved in future versions.

6. Check if E:\学习文件\React\ticket-app\node_modules         \eslint is outside your project directory.
For example, you might have accidentally installed something in your home f         older.

7. Try running npm ls eslint in your project folder.
This will tell you which other package (apart from the expected react-scrip         ts) installed eslint.

If nothing else helps, add SKIP_PREFLIGHT_CHECK=true to an .env file in your pro         ject.
That would permanently disable this preflight check in case you want to proceed          anyway.

P.S. We know this message is long but please read the steps above :-) We hope yo         u find them helpful!

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ticket-app@0.1.0 start-js: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ticket-app@0.1.0 start-js script.
npm ERR! This is probably not a problem with npm. There is likely additional log         ging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     F:\nodejs\node_cache\_logs\2018-11-13T09_20_40_840Z-debug.log
ERROR: "start-js" exited with 1.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ticket-app@0.1.0 start: `npm-run-all -p watch-css start-js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ticket-app@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional log         ging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     F:\nodejs\node_cache\_logs\2018-11-13T09_20_42_191Z-debug.log

在遇到问题的时候,错误的提示是很重要的。终于解决了。。。

阅读更多
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐