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

Init fails if npm is used from fnm #2881

Open
strowk opened this issue Aug 18, 2024 · 1 comment
Open

Init fails if npm is used from fnm #2881

strowk opened this issue Aug 18, 2024 · 1 comment
Labels
kind/bug Something isn't working

Comments

@strowk
Copy link

strowk commented Aug 18, 2024

What happened?

I had node installation using fnm on Windows. Windows PATH does not contain in this installation path to npm, as in this case used node version (and corresponding npm) vary depending on .node-version file, as it should be. Unfortunately this seems to break devspace, as running devspace init causes this:

Finishing installation of DevSpace CLI
Running: node C:\Users\strow\AppData\Local\fnm_multishells\32200_1724002495600/node_modules/devspace/bin/..//index.js finish-install C:\Users\strow\AppData\Local\fnm_multishells\32200_1724002495600/node_modules/devspace/bin
################################################
WARNING: npm binary directory NOT in $PATH environment variable: C:\Users\strow\AppData\Roaming\fnm\node-versions\v20.16.0\installation\bin
################################################

What did you expect to happen instead?

Normal init results, no errors.

How can we reproduce the bug? (as minimally and precisely as possible)

Local Environment:

  • DevSpace Version: Cannot retrieve it, as devspace --version seems to be giving the same error
  • Operating System: Windows 11
  • ARCH of the OS: AMD64

Workaround

Adding path C:\Users\strow\AppData\Roaming\fnm\node-versions\v20.16.0\installation\bin to Windows system Path environment variable, seems to make it work, but it is not a good workaround, as it breaks the idea of how fnm is supposed to choose node version depending on .node-version file, hence is unusable in long term.

@strowk strowk added the kind/bug Something isn't working label Aug 18, 2024
@erickmcarvalho
Copy link

Here is another workaround to avoid putting in the $PATH:

fnm exec --using=20 devspace

Of course, it depends on your default Node version.
If you want to ease the command, you can create an alias:

alias devspace="fnm exec --using=20 devspace"

This way we can use the devspace command normally. 😎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants