realm-js: Can't build on iOS due supporting "n" version manager
Goals
Fix issue with shellScript
Need to revert this PR https://github.com/realm/realm-js/pull/2078
Expected Results
Build and Run iOS app
Actual Results
RealmJS requires a node package manager (n or nvm).
Command /bin/sh failed with exit code 1
Steps to Reproduce
Replace shellScript in file src/RealmJS.xcodeproj on line 863 with code before PR:
shellScript = "if [[ -d \"$HOME/.asdf/shims\" ]]; then\n export PATH=$HOME/.asdf/shims:$PATH\nfi\n\n[ -z \"$NVM_DIR\" ] && export NVM_DIR=\"$HOME/.nvm\"\n\nif [[ -s \"$HOME/.nvm/nvm.sh\" ]]; then\n . \"$HOME/.nvm/nvm.sh\"\nelif [[ -x \"$(command -v brew)\" && -s \"$(brew --prefix nvm)/nvm.sh\" ]]; then\n . \"$(brew --prefix nvm)/nvm.sh\"\nfi\n \nif [[ \"$(command -v nvm)\" ]]; then\n nvm install 7.10.0\nfi\n \n node ../scripts/download-realm.js ios --sync";
It works
Version of Realm and Tooling
- Realm JS SDK Version: 2.19
- Node or React Native: Node 10.13, ReactNative 0.57.4
- Client OS & Version: MacOS 10.13
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 10
- Comments: 25 (8 by maintainers)
@shubham1164 or just rewrite line
863
withshellScript = "node ../scripts/download-realm.js ios --sync";
@kneth any progress of this? I know it is paused due test issues https://github.com/realm/realm-js/pull/2109 . Quick hot fix should be removing
exit
statement. It will work like before merging commit but still support ofn
@radeno I hope to return to it this week 🤞
Thanks radeno for the fix, I got built on iOS working now, but this should not be an error 😦
I personally prefer
nodenv
. It works the exact same way asrbenv
, if you’re familiar with that. But,realm
wants eithern
ornvm
, which I think isn’t fair. It should just want and expect a version ofnode
. Not any, or worse a specific, node package manager.i have this error realmjs requires a node package manager (n or nvm). radeno solution not work
@aljs Thanks for reporting. I’ll take time tomorrow to fix it.
I can’t build Release version because of it. Realm switches nvm to 7.10.0 and react-packager does not support this version:
Or better way.
Check first if
node
command is available and then check version withnode -v
After that check if any node is not available or version missmatch. Then show error message. Do not force autoinstall. Is not worse than make what user does not except. If someone want to use Node.js package it is in 99,9% true that has installed node.js. Just required minimal version can be different.@kneth Do you use nvm? Because i don’t use any
nvm
norn
. My node versions are handled withhomebrew