反应本机初始化错误:在“npm”注册表上找不到包“error-ex”
Posted
技术标签:
【中文标题】反应本机初始化错误:在“npm”注册表上找不到包“error-ex”【英文标题】:React native init error: Couldn't find package "error-ex" on the "npm" registry 【发布时间】:2020-05-27 18:35:32 【问题描述】:我已经在做一个 react native 项目。但是,我需要创建一个新的示例项目。当我尝试使用 react-native init Project001
启动新的示例项目并且我已经全局安装了 react native cli 时,发生了以下错误。有人能帮忙吗 ?
感谢您的帮助!
$ react-native init Project001
This will walk you through creating a new React Native project in D:\Sample project\Project001
Using yarn v1.21.1
Installing react-native...
yarn add v1.21.1
info No lockfile found.
[1/4] Resolving packages...
warning react-native > fbjs-scripts > core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning react-native > fbjs > core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning react-native > create-react-class > fbjs > core-js@1.2.7: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning react-native > metro-babel-register > core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
error Couldn't find package "error-ex" on the "npm" registry.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
Error: Couldn't find package "errorhandler" on the "npm" registry.
at MessageError.ExtendableBuiltin (C:\Users\Sanjeewa\AppData\Roaming\npm\node_modules\yarn\lib\cli.js:721:66)
at new MessageError (C:\Users\Sanjeewa\AppData\Roaming\npm\node_modules\yarn\lib\cli.js:750:123)
at NpmResolver.<anonymous> (C:\Users\Sanjeewa\AppData\Roaming\npm\node_modules\yarn\lib\cli.js:50683:15)
at Generator.next (<anonymous>)
at step (C:\Users\Sanjeewa\AppData\Roaming\npm\node_modules\yarn\lib\cli.js:310:30)
at C:\Users\Sanjeewa\AppData\Roaming\npm\node_modules\yarn\lib\cli.js:321:13
at process._tickCallback (internal/process/next_tick.js:68:7)
Error: Couldn't find package "error-ex" on the "npm" registry.
at MessageError.ExtendableBuiltin (C:\Users\Sanjeewa\AppData\Roaming\npm\node_modules\yarn\lib\cli.js:721:66)
at new MessageError (C:\Users\Sanjeewa\AppData\Roaming\npm\node_modules\yarn\lib\cli.js:750:123)
at NpmResolver.<anonymous> (C:\Users\Sanjeewa\AppData\Roaming\npm\node_modules\yarn\lib\cli.js:50683:15)
at Generator.next (<anonymous>)
at step (C:\Users\Sanjeewa\AppData\Roaming\npm\node_modules\yarn\lib\cli.js:310:30)
at C:\Users\Sanjeewa\AppData\Roaming\npm\node_modules\yarn\lib\cli.js:321:13
at process._tickCallback (internal/process/next_tick.js:68:7)
Error: Command failed: yarn add react-native --exact
at checkExecSyncError (child_process.js:629:11)
at execSync (child_process.js:666:13)
at run (C:\Users\Sanjeewa\AppData\Roaming\npm\node_modules\react-native-cli\index.js:294:5)
at createProject (C:\Users\Sanjeewa\AppData\Roaming\npm\node_modules\react-native-cli\index.js:249:3)
at C:\Users\Sanjeewa\AppData\Roaming\npm\node_modules\react-native-cli\index.js:217:7
at C:\Users\Sanjeewa\AppData\Roaming\npm\node_modules\react-native-cli\node_modules\prompt\lib\prompt.js:316:32
at C:\Users\Sanjeewa\AppData\Roaming\npm\node_modules\react-native-cli\node_modules\async\lib\async.js:142:25
at assembler (C:\Users\Sanjeewa\AppData\Roaming\npm\node_modules\react-native-cli\node_modules\prompt\lib\prompt.js:313:9)
at C:\Users\Sanjeewa\AppData\Roaming\npm\node_modules\react-native-cli\node_modules\prompt\lib\prompt.js:322:32
at C:\Users\Sanjeewa\AppData\Roaming\npm\node_modules\react-native-cli\node_modules\prompt\lib\prompt.js:597:5
status: 1,
signal: null,
output: [ null, null, null ],
pid: 6592,
stdout: null,
stderr: null
Command `yarn add react-native --exact` failed.
【问题讨论】:
npm 注册表中出现了一些错误。您可以在这里查看状态:status.npmjs.org,应该很快就会解决。 npm has a problem in installing certain packages 【参考方案1】:我认为问题仍然存在?我遇到了这种错误:
Error: Couldn't find package "error-ex" on the "npm" registry.
at MessageError.ExtendableBuiltin (C:\Program Files (x86)\Yarn\lib\cli.js:721:66)
at new MessageError (C:\Program Files (x86)\Yarn\lib\cli.js:750:123)
at NpmResolver.<anonymous> (C:\Program Files (x86)\Yarn\lib\cli.js:50302:15)
at Generator.next (<anonymous>)
at step (C:\Program Files (x86)\Yarn\lib\cli.js:310:30)
at C:\Program Files (x86)\Yarn\lib\cli.js:321:13
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
【讨论】:
是的,它仍然存在问题,我在多伦多也遇到了类似的错误。 (显然世界上的某些地区可以工作,而其他地区则不能,所以如果你现在真的需要安装一些东西,试试 *** 或其他东西) 我遇到了同样的问题。现在我已使用 *** 连接到美国,但未显示此问题。感谢您的建议。【参考方案2】:试试这个亲爱的终端npm config set registry https://skimdb.npmjs.com/registry
【讨论】:
以上是关于反应本机初始化错误:在“npm”注册表上找不到包“error-ex”的主要内容,如果未能解决你的问题,请参考以下文章
在 Xcode 中构建反应本机项目的问题 - 错误:找不到自动链接库 + 未定义符号等