我已经在从事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.
答案 0 :(得分:0)
我认为问题仍然存在?我遇到这种错误:
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)
答案 1 :(得分:0)
在您的终端npm config set registry https://skimdb.npmjs.com/registry
中尝试这个亲爱的人