Node modules disappear after initializing the localy installed ESLint

后端 未结 1 635
暗喜
暗喜 2021-01-15 20:15

In my initial react application (created by react-native init project_name). In my project folder, I install my ESLint locally by yarn add eslint --dev

相关标签:
1条回答
  • 2021-01-15 20:54

    This is caused by a bug in NPM 5 where npm install will delete almost all of your dependencies. This was the relevant issue. Even though you are using yarn, eslint will use npm under the hood to install the dependencies it needs, and thus will run into the aforementioned bug.

    This has very recently been fixed in npm >= 5.7.1, so you will need to upgrade npm and then reinstall all of your modules.

    Personally, I'd just recreate the entire project from scratch since it doesn't seem like you've done anything yet. It would be a lot more straightforward than trying to fix things.

    By upgrading, you will also be able to use react-native-cli without error as prior to v5.7.1, you were actually supposed to use NPM 4. See this bug.

    0 讨论(0)
提交回复
热议问题