我是个新来的本地人.我用react-native init XXX
英镑创建了一个新项目.在启动xcodeproj时,我收到一个错误消息:
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+.
我正在使用NVM管理我的 node .js版本.在regular terminal window中,我有这样一个:
$ node --version
v5.1.0
但在xcode中,当它运行start shell脚本时,我看到它使用的是另一个版本v0.10.40
,xcode也不知道nvm
命令..
The question is, how should I configure my Mac so the xcode can pick up the same version that I set with nvm?
非常感谢.
Update:我试图在xcode执行的shell脚本中输入我的~/.bash_profile
,但仍然没有解决问题.