Open batusai513 opened 3 years ago
Hi @batusai513, that's a strange one. To clarify, when the default Terminal app opens, it's using zsh
or bash
? The issue title mentions bash
, but from the description it looks like it's all in zsh
?
There are a few things that confuse me: First is that zsh
itself should use .zshrc
in both cases, so it should have the same environment setup either way. Second is that if a Node version is installed successfully, then it should be available.
If you have some time, could you provide the output of a few commands from both iTerm (where it works) and Terminal (where it doesn't)?
$ which volta
$ which node
$ ls -l $VOLTA_HOME/bin
$ echo $PATH
I suspect there's some subtle differences between the two environments that are causing a strange interaction, but this definitely isn't expected behavior.
Hi @charlespierce yes, you are right, it's actually a zsh session.
checking the environment itself, the .zshrc
is configured correctly (also for .bashrc
and .profile
.
After more testing one thing that I noted is that the problem arises when I run the npx react-native run-ios
command in iTerm, which at then end it executes /Users/richard.roncancio/projects/react-native/testTs/node_modules/react-native/scripts/launchPackager.command; exit
which open the terminal application (the default one), and from there I get the error previously mentioned, when I open terminal in a normal way (from application folder), everything works as it should, it picks the default version of node as soon as I write node -v
.
here is a screenshot:
even when opening new tabs on that same terminal session, the problem persist.
which volta
/Users/richard.roncancio/.volta/bin/volta
which node
/Users/richard.roncancio/.volta/bin/node
echo $PATH
/Users/richard.roncancio/.volta/bin:/Users/richard.roncancio/bin:/usr/local/bin:/Users/richard.roncancio/.rbenv/shims:/Users/richard.roncancio/.config/nvcode/utils/bin:/usr/local/sbin:/Users/richard.roncancio/.cargo/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Apple/usr/bin
ls -l $VOLTA_HOME/bin
total 34608
lrwxr-xr-x 1 richard.roncancio AUTO1\Domain Users 46 Jun 23 16:16 css-languageserver -> /Users/richard.roncancio/.volta/bin/volta-shim
lrwxr-xr-x 1 richard.roncancio AUTO1\Domain Users 46 Jun 23 22:41 expo -> /Users/richard.roncancio/.volta/bin/volta-shim
lrwxr-xr-x 1 richard.roncancio AUTO1\Domain Users 46 Jun 23 22:41 expo-cli -> /Users/richard.roncancio/.volta/bin/volta-shim
lrwxr-xr-x 1 richard.roncancio AUTO1\Domain Users 46 Jun 23 16:16 html-languageserver -> /Users/richard.roncancio/.volta/bin/volta-shim
lrwxr-xr-x 1 richard.roncancio AUTO1\Domain Users 46 Jun 23 16:16 node -> /Users/richard.roncancio/.volta/bin/volta-shim
lrwxr-xr-x 1 richard.roncancio AUTO1\Domain Users 46 Jun 23 16:16 now -> /Users/richard.roncancio/.volta/bin/volta-shim
lrwxr-xr-x 1 richard.roncancio AUTO1\Domain Users 46 Jun 23 16:16 npm -> /Users/richard.roncancio/.volta/bin/volta-shim
lrwxr-xr-x 1 richard.roncancio AUTO1\Domain Users 46 Jun 23 16:16 npx -> /Users/richard.roncancio/.volta/bin/volta-shim
lrwxr-xr-x 1 richard.roncancio AUTO1\Domain Users 46 Jun 23 16:16 pm2 -> /Users/richard.roncancio/.volta/bin/volta-shim
lrwxr-xr-x 1 richard.roncancio AUTO1\Domain Users 46 Jun 23 16:16 pm2-dev -> /Users/richard.roncancio/.volta/bin/volta-shim
lrwxr-xr-x 1 richard.roncancio AUTO1\Domain Users 46 Jun 23 16:16 pm2-docker -> /Users/richard.roncancio/.volta/bin/volta-shim
lrwxr-xr-x 1 richard.roncancio AUTO1\Domain Users 46 Jun 23 16:16 pm2-runtime -> /Users/richard.roncancio/.volta/bin/volta-shim
lrwxr-xr-x 1 richard.roncancio AUTO1\Domain Users 46 Jun 23 16:16 prettier -> /Users/richard.roncancio/.volta/bin/volta-shim
lrwxr-xr-x 1 richard.roncancio AUTO1\Domain Users 46 Jun 24 22:31 react-native -> /Users/richard.roncancio/.volta/bin/volta-shim
lrwxr-xr-x 1 richard.roncancio AUTO1\Domain Users 46 Jun 23 16:16 rush -> /Users/richard.roncancio/.volta/bin/volta-shim
lrwxr-xr-x 1 richard.roncancio AUTO1\Domain Users 46 Jun 23 16:16 rushx -> /Users/richard.roncancio/.volta/bin/volta-shim
lrwxr-xr-x 1 richard.roncancio AUTO1\Domain Users 46 Jun 23 16:16 tsc -> /Users/richard.roncancio/.volta/bin/volta-shim
lrwxr-xr-x 1 richard.roncancio AUTO1\Domain Users 46 Jun 23 16:16 tsserver -> /Users/richard.roncancio/.volta/bin/volta-shim
lrwxr-xr-x 1 richard.roncancio AUTO1\Domain Users 46 Jun 23 16:16 typescript-language-server -> /Users/richard.roncancio/.volta/bin/volta-shim
-rwxr-xr-x 1 richard.roncancio AUTO1\Domain Users 7169496 Apr 21 06:26 volta
-rwxr-xr-x 1 richard.roncancio AUTO1\Domain Users 4392584 Apr 21 06:25 volta-migrate
-rwxr-xr-x 1 richard.roncancio AUTO1\Domain Users 6150976 Apr 21 06:25 volta-shim
lrwxr-xr-x 1 richard.roncancio AUTO1\Domain Users 46 Jun 23 16:16 yarn -> /Users/richard.roncancio/.volta/bin/volta-shim
which volta
/Users/richard.roncancio/.volta/bin/volta
which node
/Users/richard.roncancio/.volta/bin/node
echo $PATH
/Users/richard.roncancio/.volta/bin:/Users/richard.roncancio/bin:/usr/local/bin:/Users/richard.roncancio/.rbenv/shims:/Users/richard.roncancio/.config/nvcode/utils/bin:/usr/local/sbin:/Users/richard.roncancio/.cargo/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Apple/usr/bin
ls -l $VOLTA_HOME/bin
total 34608
lrwxr-xr-x 1 richard.roncancio AUTO1\Domain Users 46 Jun 23 16:16 css-languageserver -> /Users/richard.roncancio/.volta/bin/volta-shim
lrwxr-xr-x 1 richard.roncancio AUTO1\Domain Users 46 Jun 23 22:41 expo -> /Users/richard.roncancio/.volta/bin/volta-shim
lrwxr-xr-x 1 richard.roncancio AUTO1\Domain Users 46 Jun 23 22:41 expo-cli -> /Users/richard.roncancio/.volta/bin/volta-shim
lrwxr-xr-x 1 richard.roncancio AUTO1\Domain Users 46 Jun 23 16:16 html-languageserver -> /Users/richard.roncancio/.volta/bin/volta-shim
lrwxr-xr-x 1 richard.roncancio AUTO1\Domain Users 46 Jun 23 16:16 node -> /Users/richard.roncancio/.volta/bin/volta-shim
lrwxr-xr-x 1 richard.roncancio AUTO1\Domain Users 46 Jun 23 16:16 now -> /Users/richard.roncancio/.volta/bin/volta-shim
lrwxr-xr-x 1 richard.roncancio AUTO1\Domain Users 46 Jun 23 16:16 npm -> /Users/richard.roncancio/.volta/bin/volta-shim
lrwxr-xr-x 1 richard.roncancio AUTO1\Domain Users 46 Jun 23 16:16 npx -> /Users/richard.roncancio/.volta/bin/volta-shim
lrwxr-xr-x 1 richard.roncancio AUTO1\Domain Users 46 Jun 23 16:16 pm2 -> /Users/richard.roncancio/.volta/bin/volta-shim
lrwxr-xr-x 1 richard.roncancio AUTO1\Domain Users 46 Jun 23 16:16 pm2-dev -> /Users/richard.roncancio/.volta/bin/volta-shim
lrwxr-xr-x 1 richard.roncancio AUTO1\Domain Users 46 Jun 23 16:16 pm2-docker -> /Users/richard.roncancio/.volta/bin/volta-shim
lrwxr-xr-x 1 richard.roncancio AUTO1\Domain Users 46 Jun 23 16:16 pm2-runtime -> /Users/richard.roncancio/.volta/bin/volta-shim
lrwxr-xr-x 1 richard.roncancio AUTO1\Domain Users 46 Jun 23 16:16 prettier -> /Users/richard.roncancio/.volta/bin/volta-shim
lrwxr-xr-x 1 richard.roncancio AUTO1\Domain Users 46 Jun 24 22:31 react-native -> /Users/richard.roncancio/.volta/bin/volta-shim
lrwxr-xr-x 1 richard.roncancio AUTO1\Domain Users 46 Jun 23 16:16 rush -> /Users/richard.roncancio/.volta/bin/volta-shim
lrwxr-xr-x 1 richard.roncancio AUTO1\Domain Users 46 Jun 23 16:16 rushx -> /Users/richard.roncancio/.volta/bin/volta-shim
lrwxr-xr-x 1 richard.roncancio AUTO1\Domain Users 46 Jun 23 16:16 tsc -> /Users/richard.roncancio/.volta/bin/volta-shim
lrwxr-xr-x 1 richard.roncancio AUTO1\Domain Users 46 Jun 23 16:16 tsserver -> /Users/richard.roncancio/.volta/bin/volta-shim
lrwxr-xr-x 1 richard.roncancio AUTO1\Domain Users 46 Jun 23 16:16 typescript-language-server -> /Users/richard.roncancio/.volta/bin/volta-shim
-rwxr-xr-x 1 richard.roncancio AUTO1\Domain Users 7169496 Apr 21 06:26 volta
-rwxr-xr-x 1 richard.roncancio AUTO1\Domain Users 4392584 Apr 21 06:25 volta-migrate
-rwxr-xr-x 1 richard.roncancio AUTO1\Domain Users 6150976 Apr 21 06:25 volta-shim
lrwxr-xr-x 1 richard.roncancio AUTO1\Domain Users 46 Jun 23 16:16 yarn -> /Users/richard.roncancio/.volta/bin/volta-shim
Thanks for your help.
Hi @batusai513, sorry for the delayed response! I didn't see your follow-up comment come in ๐
That's even more strange, since it appears that the two environments are identical and set up for Volta properly. Volta itself is running, it's just not able to determine the appropriate version of Node to use. If you have the opportunity, could you run the following in the "broken" terminal environment:
VOLTA_LOGLEVEL=debug node -v
That should output additional information showing what Volta found (or didn't find) when looking for the Node version, which may help us understand why it can't find the appropriate version.
Also seeing this, had to remove Volta unfortunately because it was a blocker.
@rdsedmundo Thanks for reporting and sorry it's not working for you either. Was it also with the terminal launched by npx react-native run-ios
?
Yes, it's precisely the same scenario, XCode is trying to launch it and returning this error. I'll try to see if I can add this environment variable to bring you the logs.
Good to know, thanks! I'll also take a look locally and see if I can reproduce.
Just run it, those are the Volta messages:
[verbose] node@14.17.0 has already been fetched, skipping download
[verbose] yarn@1.19.1 has already been fetched, skipping download
[verbose] Active Image:
Node: 14.17.0 from project configuration
npm: 6.14.13 from project configuration
Yarn: 1.19.1 from project configuration
[...]
[verbose] Could not find Volta-managed platform, delegating to system
(this was repeated ~2000 times)
[...]
Volta error: Node is not available.
To run any Node command, first set a default version using `volta install node`
[verbose] Error cause: Resource temporarily unavailable (os error 35)
Error details written to /Users/rdsedmundoxo/.volta/log/volta-error-2021-07-16_19_17_38.726.log
[...]
[verbose] No custom hooks found
(this was repeated ~2000 times)
/Users/rdsedmundoxo/.volta/log/volta-error-2021-07-16_19_17_38.726.log
"node" "-e" "console.log(require(\'path\').dirname(require.resolve(\'react-native-codegen/package.json\')))"
Volta v1.0.4
Node is not available.
To run any Node command, first set a default version using `volta install node`
Error cause: Resource temporarily unavailable (os error 35)
Ahh, thank you for that! The massive repetition is a big clue: It looks like Volta isn't setting the PATH up correctly and so it is infinitely recursing into itself, which eventually is killed by the OS. I'll dig in a bit and see if I can figure out why it's not able to find the appropriate Node version.
Okay, thanks to the additional info, I was able to reproduce locally and figure out what's going on:
node
and then check it if we are invoked again)PATH
to have node
available directly.npx react-native run-ios
), our assumption is broken:
i. Running npx react-native run-ios
goes through Volta, so we set the environment variable and the PATH appropriately.
ii. Internally, react-native
launches a separate terminal which inherits the environment variables from the react-native
process (including the recursion one we set in step i)
iii. However, since it is a new Terminal, the shell starts up and rewrites the PATH, so that isn't inherited from the react-native
process.
iv. The end result is that you wind up with an environment that is a fresh shell with no PATH modifications but at the same time has the Volta recursion environment variable already set.
v. Volta doesn't handle that case and so it either goes into a loop or acts as though it doesn't know how to find Node at all.So far, I've found 2 possible workarounds:
npx react-native start
, which then allows npx react-native run-ios
to work without having to spawn a new terminal at all..zshrc
or .bash_profile
:
unset _VOLTA_TOOL_RECURSION
The latter will make it so that at the start of a new terminal session, we guarantee that the recursion environment variable is not set. That is intended to be an internal implementation detail, however for this case it looks like we need to use it. Given that, I think the longer-term solution would be for Volta itself to include that line when it's installed.
@rdsedmundo @batusai513 Do either of those solutions (especially the latter, since that should make things "just work") work for you? Thanks again for your patience and for helping to debug what is going on!
I already have my metro running in a separate tab, I don't think that is the issue. The command it's trying to run is: node -e console.log(require(\'path\').dirname(require.resolve(\'react-native-codegen/package.json
as my log suggested.
In any case, I tried to unset the _VOLTA_TOOL_RECURSION and it still fails. ๐ข
@rdsedmundo Hmm, that's unfortunate ๐ Given that this is the same situation of it trying to open a new terminal, I suspect the root cause is similar (though different enough to not work with the same fix). If you can open a new tab in the "bugged" terminal after it shows its error and run env
, that may help determine what the full environment is that's breaking things. Thanks again!
For me this is hot/cold. All worked fine Monday and Tuesday. Today no dice.
My workaround is to run my regular script to launch the simulator. This launches simulator and fails since the launched terminal fails as discussed above in this issue.
So i close that terminal and then
npx react-native start
within my ide integrated terminal
And reload simulator.
For me this is hot/cold. All worked fine Monday and Tuesday. Today no dice.
That's extra frustrating for you, and extra difficult to diagnose as well. One would expect the environment to be consistent between different runs, yet you're seeing significant changes ๐
@charlespierce Thanks for digging in to this! The 2nd option worked for me โ
Add the following line to your .zshrc or .bash_profile:
unset _VOLTA_TOOL_RECURSION
โค๏ธ Volta!
I'm also having this same issue. It would be good if we didn't have to add this workaround and instead, react-native was supported out of the box, it is a widely used framework nowadays.
Tried the solutions posted above but none worked for me. I'm also experiencing this issue when trying to build the app for android. Here are the logs I get:
mobile-app % ./android/gradlew clean app:assembleRelease -p android/ -DENVFILE=.env.production
:ReactNative:Unexpected empty result of running '[node, -e, console.log(require('react-native/cli').bin);]' command.
:ReactNative:Running '[node, -e, console.log(require('react-native/cli').bin);]' command failed.
FAILURE: Build failed with an exception.
* Where:
Script '/Users/[redacted]/Projects/BenchApp-React/packages/mobile-app/node_modules/@react-native-community/cli-platform-android/native_modules.gradle' line: 205
* What went wrong:
A problem occurred evaluating script.
> Volta error: Node is not available.To run any Node command, first set a default version using `volta install node`Error details written to /Users/[redacted]/.volta/log/volta-error-2022-01-14_08_30_00.705.log
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 961ms
Also running into this issue; using unset _VOLTA_TOOL_RECURSION
fixed the issue in some places but not in others (Gradle).
I ran into this same error and had to install yarn
because the command I was running that triggered this error was using it behind the scenes.
just started using volta today and unfortunately am facing the same issue, kinda.
at the moment volta only works in VSCodes terminal. Terminal app (macOS) & iTerm won't work when launching a new terminal, $SHELL
is zsh, volta -v
or node -v
return "command not found", though after running zsh
everything works fine ๐คจ
seems I fixed it for now by running zsh
in XCode build phase
Same issue here, why this is so hard to fix ?
In my case
which volta
/opt/homebrew/bin/volta
I am using fish shell
Seems none of the below has any effect:
set -gx PATH $PATH "$VOLTA_HOME/bin"
export PATH=$PATH:~/.volta/bin
update:
just did a bit research this seems fixed the problem fish_add_path .volta/bin
Have the same issue with
Nvm, it seems a silly mistake that got solved with zsh
and npx @fab/cli init -y
, and the unset method didn't work :(npm i -g yarn
Fixed using this trick in your .bashrc
(or equivalent like .zshrc
) (thanks https://github.com/volta-cli/volta/issues/665#issuecomment-585953474)
# SEE https://github.com/volta-cli/volta/issues/665#issuecomment-585953474
export PATH="$VOLTA_HOME/bin:$PATH"
I was facing this when trying to build React Native Android apps.
The fix I stumbled on which works for me was to edit (project root)/android/gradlew
and update the first two lines to look like this:
#!/usr/bin/env sh
volta install node
It's not ideal though, as when I commit this change, it'll break for any of my colleagues who don't use Volta.
Hi all so I encountered a similar issue. In my case the issue was caused by having previously installed (then later uninstalled) node via homebrew
, which meant that an outdated alias /usr/local/bin/node
file was hanging around on my machine. When attempting to run my react-native
project from Xcode, it was attempting to use this alias. After installing node
with volta
I ran the following to fix the issue:
# Removes the existing empty directory
sudo rm -f /usr/local/bin/node
# Adds a new node alias (which points to the node executable installed via volta)
sudo ln -s $(which node) /usr/local/bin/node
Credit to this thread (StackOverflow) for helping me out!
Trying react-native on macos using the fish shell and I am seeing the same behavior. I have no previous version of node installed through any other methods than volta.
Setting set -e _VOLTA_TOOL_RECURSION
worked for shells I open in macos terminal myself, but some tooling in react-native was still seeing the 'node is not available' message. I tried appending unset _VOLTA_TOOL_RECURSION
to my .bashrc but this didn't help.
What did help was symlinking the output of volta which node
to my local bin dir, which bypasses volta. It's not ideal but it lets the react native tooling run.
sudo ln -s $(volta which node) /usr/local/bin/node
I'm having the same problem, I think volta will be removed in the end, it's not helping with React Native
I'm getting this error when calling yalc add
in my project and there is a postyalc
step.
I tried so far various solutions presented in this issue and nothing fixed it.
$ yalc add my-react-native
Package my-react-native@0.0.15 added ==> /Users/cyril/src/my-ios/node_modules/my-react-native
Running postyalc.my-react-native script: yarn run strip-storybook node_modules/my-react-native/index.js; yarn run strip-storybook .yalc/my-react-native/index.js
Volta error: Node is not available.
To run any Node command, first set a default version using `volta install node`
Error details written to /Users/cyril/.volta/log/volta-error-2022-09-15_11_05_44.868.log
yalc add
Add package from yalc repo to the project
Options:
--version Show version number [boolean]
--help Show help [boolean]
Error: Command failed: yarn postyalc.my-react-native
at checkExecSyncError (node:child_process:828:11)
at Object.execSync (node:child_process:902:15)
at runPmScript (/Users/cyril/.volta/tools/image/packages/yalc/lib/node_modules/yalc/src/add.js:121:41)
at /Users/cyril/.volta/tools/image/packages/yalc/lib/node_modules/yalc/src/add.js:262:33
at step (/Users/cyril/.volta/tools/image/packages/yalc/lib/node_modules/yalc/src/add.js:63:23)
at Object.next (/Users/cyril/.volta/tools/image/packages/yalc/lib/node_modules/yalc/src/add.js:44:53)
at fulfilled (/Users/cyril/.volta/tools/image/packages/yalc/lib/node_modules/yalc/src/add.js:35:58)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
status: 126,
signal: null,
output: [ null, null, null ],
pid: 44912,
stdout: null,
stderr: null
}
Using iTerm with zsh on MacOS 12.6
The error is totally independent of what is in the postyalc
step (I tried echo $0
for example for the same result).
i had to fix it in .profile, .bashrc and .zshrc by adding
export VOLTA_HOME=$HOME/.volta
export PATH=$VOLTA_HOME/bin:$PATH
unset _VOLTA_TOOL_RECURSION in each
in each of them. It only worked for me after doing it for all 3 shell environments (zsh, bash and sh)
Okay, thanks to the additional info, I was able to reproduce locally and figure out what's going on:
- Internally, we use an environment variable to prevent recursing infinitely (we set it when we run
node
and then check it if we are invoked again)- If that environment variable is set, we skip doing the Node version resolution, because the only time we set that value is when we are modifying the
PATH
to havenode
available directly.- In this case (
npx react-native run-ios
), our assumption is broken: i. Runningnpx react-native run-ios
goes through Volta, so we set the environment variable and the PATH appropriately. ii. Internally,react-native
launches a separate terminal which inherits the environment variables from thereact-native
process (including the recursion one we set in step i) iii. However, since it is a new Terminal, the shell starts up and rewrites the PATH, so that isn't inherited from thereact-native
process. iv. The end result is that you wind up with an environment that is a fresh shell with no PATH modifications but at the same time has the Volta recursion environment variable already set. v. Volta doesn't handle that case and so it either goes into a loop or acts as though it doesn't know how to find Node at all.So far, I've found 2 possible workarounds:
- Run the bundler manually in a separate terminal session using
npx react-native start
, which then allowsnpx react-native run-ios
to work without having to spawn a new terminal at all.- Add the following line to your
.zshrc
or.bash_profile
:unset _VOLTA_TOOL_RECURSION
The latter will make it so that at the start of a new terminal session, we guarantee that the recursion environment variable is not set. That is intended to be an internal implementation detail, however for this case it looks like we need to use it. Given that, I think the longer-term solution would be for Volta itself to include that line when it's installed.
@rdsedmundo @batusai513 Do either of those solutions (especially the latter, since that should make things "just work") work for you? Thanks again for your patience and for helping to debug what is going on!
Holy Crap, This worked for me. Thanks for explanation
After reading all this thread I went back to the error I was getting, and noticed that my project had a package.json
and a yarn.json
. Then I looked carefully at the error again and noticed that the error also said...
Error: Command failed: yarn --version
Volta error: Node is not available.
I removed the yarn.json
file, since I'm utilizing npm
, and ran the command again and everything started working.
I'm on macOS Ventura and for some reason it stopped working. I just had to run:
$ volta setup
Not sure what I did for it to stop working to begin with, but after 20 minutes of troubleshooting various config options, this is what did it for me.
2nd time i had to give up on volta , and go back to nvm this year
not bothering with volta again
I'm on macOS Ventura and for some reason it stopped working. I just had to run:
$ volta setup
Not sure what I did for it to stop working to begin with, but after 20 minutes of troubleshooting various config options, this is what did it for me.
I had the same issue after running the Migration Assistant to migrate from Intel to Silicon M3. Initially it was installing x84
versions but after I purge the old node directory this problem was solved. Nonetheless, I started facing another problem, as for the table below.
OS | Volta version | Description |
---|---|---|
macOS Sonoma 14.1 | 1.1.1 | node not found whenever trying any node command |
To fix it I has just to run volta setup
and restart the terminal. I'm on zsh.
Hope it helps!
I added the suggested line into Xcode's Bundle React Native code and images build phase:
unset _VOLTA_TOOL_RECURSION
right before export NODE_BINARY=node
This looks like the cleanest way to deal with it, since I'm not versioning any machine-specific paths in that file (and manually adding and then discarding the actual path on each build feels so wrong in the Age of Automation). Besides, that's the closest you can get from the source of the problem, so this won't affect how Volta behaves on the rest of my system and just won't have an effect at all for those who don't use Volta.
Though I have yet to more thoroughly test it, it seems to do the trick.
I added the suggested line into Xcode's Bundle React Native code and images build phase:
unset _VOLTA_TOOL_RECURSION
right beforeexport NODE_BINARY=node
This looks like the cleanest way to deal with it, since I'm not versioning any machine-specific paths in that file (and manually adding and then discarding the actual path on each build feels so wrong in the Age of Automation). Besides, that's the closest you can get from the source of the problem, so this won't affect how Volta behaves on the rest of my system and just won't have an effect at all for those who don't use Volta.
Though I have yet to more thoroughly test it, it seems to do the trick.
For me, under my ReactNative ios folder, I copied .xcode.env
into .xcode.env.local
, and added the unset _VOLTA_TOOL_RECURSION
line. That worked and is not going to go to source control.
Currently I use iTerm with zsh and using volta from there works flawlessly, the problem start when I try to open the default macos terminal application (also with zsh), when I try to run
node -v
on first load, it shows the errorVolta error: Node is not available.
, then I runvolta install node@12
which sets the default nodesuccess: installed and set node@12.22.1 as default
, then I try again runningnode -v
and the error is shown againVolta error: Node is not available.
.I've setup volta as mentioned in the installation guide, and I mentioned earlier, it work well with iTerm.
This issue is kind of annoying because when I run the
npx react-native run-ios
it actually opens the terminal and try to runreact-native start
from there, which fails with the error mentioned before.Thanks for your time and effort creating this tool, and hopefully this problem can be worked around.
Thanks