Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nvm breaks detox build on MacOS #2623

Closed
uloco opened this issue Feb 3, 2021 · 10 comments
Closed

nvm breaks detox build on MacOS #2623

uloco opened this issue Feb 3, 2021 · 10 comments

Comments

@uloco
Copy link
Contributor

uloco commented Feb 3, 2021

When using nvm to manage node versions on MacOS(11.1), detox build fails with the following error

nvm is not compatible with the "PREFIX" environment variable: currently set to "/Users/uloco/.nvm/versions/node/v15.6.0"
Run `unset PREFIX` to unset it.
env: node: No such file or directory
Command PhaseScriptExecution failed with a nonzero exit code

Ubuntu works fine with nvm.
Also other builds that need node or npm work fine, it is just happening with detox.

Is detox setting the PREFIX environment variable somewhere? Is there any way of working around this problem?

@support
Copy link

support bot commented Feb 3, 2021

We use the issue tracker exclusively for bug reports and feature requests. This issue appears to be a general usage or support question. Instead, please ask a question on Stack Overflow with the detox tag.

Feel free to post your Stack Overflow question here for more visibility. We'll take a look at it.

For issues with Expo apps, it is most likely not an issue with Detox itself, but with the Expo runtime or with incorrect Detox setup. For support on how to use Detox with Expo, you should contact the Expo team or the Expo community.

For more information on bots in this repository, read this discussion.

@support support bot closed this as completed Feb 3, 2021
@noomorph
Copy link
Collaborator

noomorph commented Feb 3, 2021

It is unrealistic to investigate this issue provided the feedback above.
What is your command you are trying to run?
Try wrapping it in a temporary JavaScript file, e.g.:

require('child_process').execSync('my unlucky command', { stdio: 'inherit' })

and run it. Does the result differ?

@uloco
Copy link
Contributor Author

uloco commented Feb 3, 2021

Detox works fine with a normal nodejs install via .deb from the website.
Since I switched to using nvm I get the error shown above.
I am running a npm script with the just the regular detox build command: detox build -c ios.stage.release

I am trying to wrap it in a separate node script as you said. Will give feedback when the build is finished/failed

@uloco
Copy link
Contributor Author

uloco commented Feb 3, 2021

Thanks. Putting it in a separate node script and running it with node <script> solved the issue. Running it in a npm script with npm run <script> does not work though, even if it is a separate script.

@uloco
Copy link
Contributor Author

uloco commented Feb 3, 2021

But this works in a npm script unset PREFIX && detox build ...

@uloco uloco closed this as completed Feb 3, 2021
@LeoNatan
Copy link
Contributor

LeoNatan commented Feb 3, 2021

This is not related to Detox at all.

@support
Copy link

support bot commented Feb 3, 2021

We use the issue tracker exclusively for bug reports and feature requests. This issue appears to be a general usage or support question. Instead, please ask a question on Stack Overflow with the detox tag.

Feel free to post your Stack Overflow question here for more visibility. We'll take a look at it.

For issues with Expo apps, it is most likely not an issue with Detox itself, but with the Expo runtime or with incorrect Detox setup. For support on how to use Detox with Expo, you should contact the Expo team or the Expo community.

For more information on bots in this repository, read this discussion.

@uloco
Copy link
Contributor Author

uloco commented Feb 3, 2021

This issue just happens with detox build. I do not have any issues with other npm scripts or libraries. That's why I thought of a detox issue in the first place. I was thinking, that it is quite unlikely that any of you are using nvm and haven't had any issues regarding this. Thanks for clearing things up.

@LeoNatan
Copy link
Contributor

LeoNatan commented Feb 3, 2021

We are actually using NVM in some of our CIs and, as far as I know, that hasn't changed. We also had developers using NVM on their development machines.

@uloco
Copy link
Contributor Author

uloco commented Feb 4, 2021

Looks like this was still an issue by npm 2 days ago. It used to set the PREFIX env variable for no reason.
Now it is fixed: npm/cli#2398
nvm install-lastest-npm fixes this, whoever lands here. No need to unset prefix anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants