xcode使用了错误的node.js版本 [英] xcode using wrong node.js version
问题描述
我是React Native的新手。我使用 react-native init XXX
来创建一个新项目。当启动xcodeproj时,我收到一条错误消息:
I am new to React Native. I used react-native init XXX
to create a new project. When launch the xcodeproj, I got an error saying:
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 +。
According to my research, this is a node.js version issue: I should have use v.4.0+.
我使用NVM管理我的node.js版本。在常规终端窗口中,我有:
I am using NVM to manage my node.js versions. In regular terminal window, I have this:
$ node --version
v5.1.0
但是在运行start shell脚本的xcode中,我看到它使用的是另一个版本, v0.10.40
,xcode不知道 nvm
命令..
but in xcode when it run the start shell script, I saw it is using a different version, v0.10.40
, and xcode doesn't know about nvm
command either..
问题是,我应该如何配置我的Mac,以便xcode能够获得我使用nvm设置的相同版本?
谢谢!
更新:我试过源
我的〜/ .bash_profile
在xcode执行的shell脚本中,但仍无法解决问题。
Update: I tried to source
my ~/.bash_profile
in the shell script executed by xcode, but still not solving the problem.
推荐答案
我通过添加解决了这个问题。 〜\ .bash_profile
到shell脚本的顶部。
I resolved the issue by adding . ~\.bash_profile
to the top of shell script.
这篇关于xcode使用了错误的node.js版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!