Đồn*_*ọng 8 npm reactjs eslint visual-studio-code create-react-app
我有一个我无法解决的问题。我为所有项目在VSCode中使用ESLint。现在,我创建了一个新的react应用程序,但是当我运行它(npm start或yarn start)时,它会引发错误。
React应用使用ESLint 5.12.5,是我的较低版本。我尝试按照建议中的步骤进行操作,但...未解决。
谁能解决我的问题?
我试过npm uninstall -g eslint,npm uninstall eslint,npm i... bla..bla,打消了我的ESLint扩展在我VSCode,并重新创建应用程序的反应。但是错误尚未修复。
我检查了eslint -v,它表示为5.14.1,但是在错误通知中,vscode表示版本5.16.0在节点模块@@中。
当我尝试yarn start或时,这是完整的错误通知npm start:
> homework02@0.1.0 start E:\Extenal Code\Hoc JS\ReactJS-iViettech\homework02
> react-scripts start
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 locally.
The react-scripts package provided by Create React App requires a dependency:
"eslint": "5.12.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:\Extenal Code\Hoc JS\node_modules\eslint (version: 5.16.0)
Manually installing incompatible versions is known to cause hard-to-debug issues.
If you would 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 project folder.
2. Delete node_modules in your project folder.
3. Remove "eslint" from dependencies and/or devDependencies in the package.json 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 steps 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:\Extenal Code\Hoc JS\node_modules\eslint is outside your project directory.
For example, you might have accidentally installed something in your home folder.
7. Try running npm ls eslint in your project folder.
This will tell you which other package (apart from the expected react-scripts) installed eslint.
If nothing else helps, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
That would permanently disable this preflight check in case you want to proceed anyway.
Run Code Online (Sandbox Code Playgroud)
我相信这是 eslint 持续存在的问题,create-react-app详细信息如下:
https://github.com/wesbos/eslint-config-wesbos/issues/17
那里有很多建议,但我希望他们能做出更永久的修复。
| 归档时间: |
|
| 查看次数: |
1242 次 |
| 最近记录: |