【问题标题】:react native init failed反应本机初始化失败
【发布时间】:2021-09-14 21:41:11
【问题描述】:

每当我创建一个新项目时,它都会引发以下错误。我确实更新了任何设置。昨天之前一切正常。这是我的问题。

[1/4] Resolving packages...
error Couldn't find package **"@typescript-eslint/parser@^4.22.1"** required by **"@react-native-community/eslint-config"** on the "npm" registry.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
E:\example\project\node_modules\execa\index.js:174
                err = new Error(`Command failed: ${joinedCmd}${output}`);
                      ^

Error: Command failed: yarn add -D @babel/core @babel/runtime @react-native-community/eslint-config eslint jest babel-jest metro-react-native-babel-preset react-test-renderer@17.0.1
    at makeError (E:\example\project\node_modules\execa\index.js:174:9)
    at E:\example\project\node_modules\execa\index.js:278:16
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async generateProject (E:\example\project\node_modules\@react-native-community\cli\build\commands\init\initCompat.js:128:3)
    at async Object.initCompat (E:\example\project\node_modules\@react-native-community\cli\build\commands\init\initCompat.js:105:3) {
  code: 1,
  stdout: null,
  stderr: null,
  failed: true,
  signal: null,
  cmd: 'yarn add -D @babel/core @babel/runtime @react-native-community/eslint-config eslint jest babel-jest metro-react-native-babel-preset react-test-renderer@17.0.1',
  timedOut: false,
  killed: false
}

我确实删除了一个节点,更新了节点,删除了 react-native-CLI,并更新了它,它已经修复了一段时间。但我无法安装任何软件包。

现在是第 2 天,我被困在这里。

【问题讨论】:

    标签: react-native node-modules npm-install react-native-cli


    【解决方案1】:

    找了半天终于。我找到了解决方案。只需转到网络设置并关闭自动代理设置检测即可。

    【讨论】:

      【解决方案2】:

      在运行 react-native init 之前尝试运行 npm install @typescript-eslint/parser@^4.22.1 我希望它能解决问题。

      如果问题仍然存在,请尝试清除缓存:

      npm 缓存清理 --force

      【讨论】:

      • 我这样做了,但它又给出了另一个错误。我创建了一个干净的设置和环境变量设置。但情况会变得更糟。试纱。但它还有另一个问题,
      • 是的。我删除它们。重新安装。然后更新。清除临时文件。手动删除节点模块。但是,我还是遇到了问题。
      • npm 错误! registry.npmjs.org/chalk 处的无效 json 响应正文原因:意外令牌:在 JSON 中的位置 6551
      • E:\example>npx react-native init newproee npm ERR!代码 FETCH_ERROR npm ERR! errno FETCH_ERROR npm ERR! registry.npmjs.org/react-native 处的无效 json 响应正文原因:JSON 中位于 79493 npm ERR 位置的意外令牌}!可以在以下位置找到此运行的完整日志:npm ERR! C:\Users\dell\AppData\Local\npm-cache_logs\2021-07-03T07_47_40_258Z-debug.log
      • 好的尝试运行 npm config set registry "registry.npmjs.org"
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-03-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-02-24
      • 2016-03-25
      相关资源
      最近更新 更多