React Nativeでプロジェクトをinitした際にエラー

以下コマンドを実行して、React Nativeの新規プロジェクトを作成しようとしたらエラー。

$ react-native init AwesomeProject

 
エラー内容は以下。

This will walk you through creating a new React Native project in /{プロジェクトパス}/AwesomeProject
Installing react-native…
Consider installing yarn to make this faster: https://yarnpkg.com
npm ERR! cb() never called!

npm ERR! This is an error with npm itself. Please report this error at:
npm ERR!
{ Error: Command failed: npm install –save –save-exact react-native
at checkExecSyncError (child_process.js:616:11)
at execSync (child_process.js:653:13)
at run (/{ホームディレクトリ}/.nodebrew/node/v10.15.0/lib/node_modules/react-native-cli/index.js:294:5)
at createProject (/{ホームディレクトリ}/.nodebrew/node/v10.15.0/lib/node_modules/react-native-cli/index.js:249:3)
at init (/{ホームディレクトリ}/.nodebrew/node/v10.15.0/lib/node_modules/react-native-cli/index.js:200:5)
at Object. (/{ホームディレクトリ}/.nodebrew/node/v10.15.0/lib/node_modules/react-native-cli/index.js:153:7)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
status: 1,
signal: null,
output: [ null, null, null ],
pid: 50173,
stdout: null,
stderr: null }
Command npm install --save --save-exact react-native failed.

 
どうやら、npmが古いらしい。
以下コマンドでnpmのアップデートをしたら解決しました。

$ npm install -g npm
よかったらシェアしてね!
  • URLをコピーしました!
  • URLをコピーしました!

この記事を書いた人

メインはWeb系エンジニアです。

コメント

コメントする

目次