[email protected] requires a peer of [email protected] but none was installed
我正在尝试为react native设置。但是每当我更新文件时,它都会给出m错误
1 2 3 4 5 6 7 | enoent ENOENT: no such file or directory, open 'React Native/package.json' npm WARN [email protected] requires a peer of [email protected] but none was installed. npm WARN React Native No description npm WARN React Native No repository field. npm WARN React Native No README data npm WARN React Native No license field. MacBook-Pro:React Native$ npm info react dist-tags.latest |
请让我知道如何解决。
安装react应该可以修复错误
1 | npm install react --save |
此外,您可以尝试升级
1 | npm update react-native |
在我的特定情况下,我在错误的目录中运行了
就我而言,我正在从事的项目需要特定版本的React。由于它比当前版本要旧,因此执行安装/更新仍会导致错误。
为了解决问题,我必须检查项目的
1 | npm install [email protected] |
应该通过安装react-native所需的React模块的确切版本来解决该问题。
通过执行
一些对我有用的步骤:
1 2 3 4 5 6 7 | 1. watchman watch-del-all 2. rm -rf node_modules 3. npm install [email protected] --save 4. npm install [email protected] --save 5. npm install 6. rm -fr $TMPDIR/react-* 7. npm start -- --reset-cache |