5

I usually do not have any issues with nvm, but a React Native / Xcode project is failing to build because it's trying to use Node v4.4.3.

My nvm ls looks like this:

   v5.11.0
   v5.11.1
   v6.1.0
   v6.9.5
   v6.11.5
-> v8.7.0
   v10.1.0
   system

When I type nvm use system and node -v it prints 4.4.3, so I suppose that's where Xcode is getting 4.4.3 from.

But when I type nvm alias system 8.7.0 (attempting to alias the system to 8.7.0), it prints system -> 8.7.0 (-> v8.7.0) and node -v still returns 4.4.3. I also tried nvm install 8.7.0 --reinstall-packages-from=node, but that didn't really seem to do anything to help the cause.

I probably had node installed with brew at one point, but believe I've installed it because brew node -v returns Error: Unknown command: node Error: Kernel.exit.

Wondering if anyone can point me in the correct direction!

0xPingo
  • 2,047
  • 4
  • 19
  • 43
  • `nvm alias default 8.7.0` should work. – YvesLeBorg May 30 '18 at 03:29
  • It does, I don't have any issues with node from the terminal, just Xcode. It's picking up the 'system' version for some reason and I do not know how to change that. – 0xPingo May 30 '18 at 03:37
  • 1
    Similar issue was discussed in another thread https://stackoverflow.com/questions/34035421/xcode-using-wrong-node-js-version – Elvis Plesky May 30 '18 at 06:17
  • ah ... sorry, misunderstood. Well, fwiw, i dont use exCode for anything but playing certificates anymore. Got AppCode ? – YvesLeBorg May 30 '18 at 10:10

2 Answers2

3

. ~/.nvm/nvm.sh at the top of the shell script in Build Phases did the trick.

0xPingo
  • 2,047
  • 4
  • 19
  • 43
1

Try this answer: https://stackoverflow.com/a/11298299/8723007

I also installed node with brew at some point which I just forgot about it because I also use nvm.

:facepalm:

Try $ brew upgrade node in Terminal and if that doesn't work trying installing node with homebrew anyway. You should get the system version to be the most up to date. As of rn that's version 11.

valem
  • 1,690
  • 2
  • 9
  • 11