React Nativeを初めて使用しています。私はreact-native init XXX
を使って新しいプロジェクトを作成しました。 xcodeprojを起動すると、私は言ってエラーを得た:xcodeが間違ったnode.jsを使用しています
const setupEnvScript = /^win/.test(process.platform)
^^^^^
SyntaxError: Use of const in strict mode.
at Module._compile (module.js:439:25)
at Module._extensions..js (module.js:474:10)
at Object.require.extensions.(anonymous function) [as .js] (/Users/allanhahaha/Documents/Seat/getseat/SeatApp/node_modules/react-native/node_modules/babel-core/lib/api/register/node.js:214:7)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/Users/allanhahaha/Documents/Seat/getseat/SeatApp/node_modules/react-native/cli.js:15:18)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
は、私の研究によると、これは、Node.jsのバージョンの問題です:私は、使用V.4.0の+を持っている必要があります。
私はnode.jsのバージョンを管理するのにNVMを使用しています。それは、開始シェルスクリプトを実行したとき、私はそれがv0.10.40
、異なるバージョンを使用している、とXcodeはどちらかについてnvm
コマンドを知らない見た
$ node --version
v5.1.0
が、Xcodeで:通常のターミナルウィンドウで、私はこれを持っています..
問題は、xcodeがnvmで設定したものと同じバージョンを取得できるように、Macをどのように設定すればよいですか?
ありがとうございました!
更新:私はXcodeので実行されるシェルスクリプトで私の~/.bash_profile
をsource
しようとしましたが、まだ問題は解決しません。
を見ましたリアクト? https://github.com/facebook/react-native/issues/3974 –
こんにちはAllan、少なくともあなたのbash_profileには、nvmに関する部分を表示できますか? また、通常iTermやTerminalを使用していますか? – Almouro
@ColinRamsayコメントをいただきありがとうございました。 〜\ .bash_profile'そしてそれは働いた... –