最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【已解决】npm install期间出错:npm WARN enoent ENOENT: no such file or directory, open node_modules/@expo/vector-icons/package.json

npm crifan 11004浏览 0评论

折腾:

【已解决】npm install react-native-elements出错:[server error] Cannot load the stats for react-native-elements – please try again later

期间,

看到很多类似于:

npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root/daryun/Projects/xxx/node_modules/@expo/vector-icons/package.json’

的输出:

➜  rn_rse npm install [email protected]
> [email protected] postinstall /Users/crifan/dev/dev_root/xxx/node_modules/react-native-elements
> opencollective postinstall
[server error] Cannot load the stats for react-native-elements – please try again later
                  Thanks for installing react-native-elements 🙏
                 Please consider donating to our open collective
                        to help us maintain this package.
[email protected] node_modules/lodash.isempty
[email protected] /Users/crifan/dev/dev_root/xxx
  └── [email protected]
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root//node_modules/@expo/vector-icons/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root/daryun/Projects//node_modules/babel-preset-es2015-node/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root//node_modules/create-react-class/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root//node_modules/envinfo/package.json’

想办法去看看到底怎么回事。

之前记得已经:

npm install

但是还是有这个问题。

或许和之前:

把npm从5.0降版到0.46.1所导致的?

npm WARN enoent ENOENT: no such file or directory, open  package.json

npm WARN enoent ENOENT: no such file or directory, open

npm WARN enoent ENOENT: no such file or directory, open ‘<root>/node_modules/supertest/package.json’ · Issue #261 · visionmedia/debug

先去试试:

npm cache clean

npm install

➜  rn_rse npm cache clean
➜  rn_rse npm install
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root/xxxnode_modules/@expo/vector-icons/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root/xxxnode_modules/babel-preset-es2015-node/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root/xxxnode_modules/create-react-class/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root/xxxnode_modules/envinfo/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root/xxxnode_modules/fbjs-scripts/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root/xxxnode_modules/find-babel-config/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root/xxxnode_modules/jest-cli/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root/xxxnode_modules/lottie-react-native/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root/xxxnode_modules/metro-bundler/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root/xxxnode_modules/node-pre-gyp/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root/xxxnode_modules/react-native-branch/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root/xxxnode_modules/react-native-gesture-handler/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root/xxxnode_modules/react-native-maps/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root/xxxnode_modules/react-native-safe-module/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root/xxxnode_modules/react-native-svg/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root/xxxnode_modules/regexpu-core/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root/xxxnode_modules/tar-pack/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root/xxxnode_modules/win-release/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root/xxxnode_modules/xcode/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root/xxxnode_modules/fbjs-scripts/node_modules/cross-spawn/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root/xxxnode_modules/metro-bundler/node_modules/fbjs/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root/xxxnode_modules/metro-bundler/node_modules/jest-haste-map/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root/xxxnode_modules/node-pre-gyp/node_modules/http-signature/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root/xxxnode_modules/node-pre-gyp/node_modules/request/package.json’
npm WARN [email protected] requires a peer of react@>=15.4.0 but none was installed.
npm WARN [email protected] requires a peer of react@> 15.0.0 but none was installed.

问题依旧。

去把本地的node_modules删除掉:

再去试试

npm install

然后卡在:

➜  rn_rse npm install
⸨░░░░░░░░░░░░░░░░░░⸩ ⠋ fetchMetadata: sill mapToRegistry uri https://registry.npm.taobao.org/qs

最后好像是可以了:

│   │ ├── [email protected]
│   │ └── [email protected]  deduped
│   ├── [email protected]  deduped
│   ├── [email protected]  deduped
│   └── [email protected]
│ ├─┬ [email protected]
│ │ ├── [email protected]  deduped
│ │ └── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├─┬ [email protected]
│ │ └── [email protected]
│ ├── [email protected]  deduped
│ ├─┬ [email protected]
│ │ └─┬ [email protected]
│ │   └── [email protected]
│ └─┬ [email protected]
│   └── [email protected]  deduped
  ├── [email protected]  deduped
  └── [email protected]  deduped
npm WARN [email protected] requires a peer of react@> 15.0.0 but none was installed.
npm WARN [email protected] requires a peer of react@>=15.4.0 but none was installed.

然后再去安装别的库,看看是否还有报错:

npm install react-native-elements –save

好像就没了上面一堆的警告了(虽然本身由于别的原因而报错):

➜  rn_rse npm install react-native-elements –save
> [email protected] postinstall /Users/crifan/dev/dev_root/xxxnode_modules/react-native-elements
> opencollective postinstall
[server error] Cannot load the stats for react-native-elements – please try again later
                  Thanks for installing react-native-elements 🙏
                 Please consider donating to our open collective
                        to help us maintain this package.
[email protected] /Users/crifan/dev/dev_root/xxx
  ├── [email protected]
  ├── [email protected]
  ├─┬ [email protected]
  │ ├─┬ [email protected]
  │ │ ├── [email protected]
  │ │ └── [email protected]
  │ ├─┬ [email protected]
  │ │ ├── [email protected]
  │ │ ├── [email protected]
  │ │ └─┬ [email protected]
  │ │   ├── [email protected]
  │ │   └─┬ [email protected]
  │ │     └── [email protected]
  │ ├── [email protected]
  │ └── [email protected]
  ├── [email protected]
  └─┬ [email protected]
    └── [email protected]
npm WARN [email protected] requires a peer of react@>=15.4.0 but none was installed.
npm WARN [email protected] requires a peer of react@> 15.0.0 but none was installed.
npm WARN [email protected] requires a peer of react-native-vector-icons@^4.2.0 but none was installed.

【总结】

还是多试了试:

npm cache clean

删除项目根目录下的node_modules文件夹,再

npm install

就可以了。还不行的话,就多试试几次。

估计导致上述警告是因为:

之前最开始安装的5.0的npm,后来降级到0.46.1了,所以估计有些版本不兼容?才报错的。

转载请注明:在路上 » 【已解决】npm install期间出错:npm WARN enoent ENOENT: no such file or directory, open node_modules/@expo/vector-icons/package.json

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
90 queries in 0.187 seconds, using 22.08MB memory