小编典典

初始化本地安装的ESLint后,节点模块消失

reactjs

在我最初的react应用程序中(由创建react-native init project_name)。在我的项目文件夹中,我通过安装本地ESLint
yarn add eslint --dev。然后,通过./node_modules/.bin/eslint --init(使用Airbnb样式指南,使用ReactJSON配置文件格式)初始化配置。安装的eslint消失在./node_modules/.bin文件夹中。

初始化之前: ls ./node_modules/.bin acorn eslint jest-runtime node-pre-gyp semver atob esparse js-yaml nopt sshpk-conv babylon esvalidate jsesc pegjs sshpk-sign color-support handlebars json5 rc sshpk-verify detect-libc image-size loose- envify react-native uglifyjs envinfo import-local-fixture metro regjsparser uuid escodegen is-ci mime rimraf watch esgenerate jest mkdirp sane which

初始化后: ls ./node_modules/.bin babylon esparse esvalidate jsesc loose-envify semver

我想念什么?

平台:macOS,react-native-cli:2.0.1,react-native:0.54.2


阅读 333

收藏
2020-07-22

共1个答案

小编典典

这是由NPM 5中的一个错误引起的,该错误npm install将删除您几乎所有的依赖项。这是相关的问题。即使您使用yarneslint也会npm在后台使用它来安装所需的依赖项,因此会遇到上述错误。

最近已在 npm > = 5.7.1中修复了此问题,因此您将需要升级npm,然后重新安装所有模块。

就个人而言,由于您似乎尚未完成任何工作,因此我将从头开始重新创建整个项目。 这比尝试解决问题要简单得多。

通过升级,您react-native- cli实际上还可以使用v5.7.1之前的版本,而实际上应该使用NPM4。请参见此错误。

2020-07-22