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

[Bug]: Neither Node.js nor NVM is installed when installing Herd #762

Closed
ericmp33 opened this issue May 23, 2024 · 16 comments
Closed

[Bug]: Neither Node.js nor NVM is installed when installing Herd #762

ericmp33 opened this issue May 23, 2024 · 16 comments
Labels

Comments

@ericmp33
Copy link

Platform

Windows

Operating system version

W11 23H2 (OS Build 22631.3593)

System architecture

Intel (x86)

Herd Version

1.6.1

PHP Version

PHP 8.3.7 (cli) (built: May 8 2024 08:56:34) (NTS Visual C++ 2019 x64)

Bug description

I installed Herd. In the docs says it's installed by default & it says that I can checkout what it has installed.

But when checking for nodejs:
image

Tried to search for errors/logs but idk how to fix this.
Also, the C:\Users\eric\.config\herd\bin\nvm folder is empty.

Trying to run nvm:
image

Trying to install nodejs:
I just click, i wait for some seconds and it doesn't do anything:
image

Steps to reproduce

No response

Relevant log output

No response

@issuelabeler issuelabeler bot added the windows label May 23, 2024
@ericmp33
Copy link
Author

Update:
Seems I found more logs:
C:\Users\eric\AppData\Roaming\Herd\logs\main.log

When I click to install a specific nodejs version i get this log:

[2024-05-23 19:26:22.297] [info]  [NodeVersionManager] installedNodeVersions: '"C:\\Users\\eric\\.config\\herd\\bin\\nvm\\nvm.exe"' is not recognized as an internal or external command,
operable program or batch file.

[2024-05-23 19:26:22.297] [info]  [NodeVersionManager] parseNodeVersionList: [
  `'"C:\\\\Users\\\\eric\\\\.config\\\\herd\\\\bin\\\\nvm\\\\nvm.exe"' is not recognized as an internal or external command,\r`,
  'operable program or batch file.\r',
  ''
]
[2024-05-23 19:26:22.298] [info]  [NodeVersionManager] installedNodeVersions: 
[2024-05-23 19:26:22.298] [info]  [NodeVersionManager] parseNodeVersionList: [ '' ]
[2024-05-23 19:26:23.300] [info]  [NodeVersionManager] install: 'C:\Users\eric\.config\herd\bin\nvm\nvm.exe' is not recognized as an internal or external command,
operable program or batch file.

[2024-05-23 19:26:23.300] [info]  [NodeVersionManager] install: 
[2024-05-23 19:26:24.116] [info]  [NodeVersionManager] installedNodeVersions: '"C:\\Users\\eric\\.config\\herd\\bin\\nvm\\nvm.exe"' is not recognized as an internal or external command,
operable program or batch file.

[2024-05-23 19:26:24.116] [info]  [NodeVersionManager] parseNodeVersionList: [
  `'"C:\\\\Users\\\\eric\\\\.config\\\\herd\\\\bin\\\\nvm\\\\nvm.exe"' is not recognized as an internal or external command,\r`,
  'operable program or batch file.\r',
  ''
]
[2024-05-23 19:26:24.117] [info]  [NodeVersionManager] installedNodeVersions: 
[2024-05-23 19:26:24.117] [info]  [NodeVersionManager] parseNodeVersionList: [ '' ]

@ericmp33 ericmp33 changed the title [Bug]: Node.js Not Installed with Herd [Bug]: Node.js neither NVM Aren't Installed when installing Herd May 23, 2024
@ericmp33 ericmp33 changed the title [Bug]: Node.js neither NVM Aren't Installed when installing Herd [Bug]: Neither Node.js nor NVM is installed when installing Herd May 23, 2024
@sschlein
Copy link
Member

That's odd. Can you check your environment variables if there are some from a previous NVM installation? They might also be in your path.

If you remove them and restart Herd, you should see an option to install nvm again.

@ericmp33
Copy link
Author

Yeah, well I'll explain the trip i faced.

So yeah I already checked the env variables & everywhere where could be residual nodejs/npm/nvm stuff (Some time ago I installed nodejs on the computer but I uninstalled along with PHP since at that point I was migrating to Herd so there was no point on having those manual installations - Herd would manage that for me).

Also restarted my computer & reinstalled Herd several times in different ways.

After a lot of unsuccessful tries I said, you know what, I'm gonna install nvm manually. So I downloaded the exe v1.1.12. Then I installed it manually into C:\Users\eric\.config\herd\bin\nvm.

Next, I opened Herd & tried to install the latest node version, but I got another issue (coreybutler/nvm-windows#1068):

NVM for Windows should be run from a terminal such as CMD or PowerShell

So I again uninstalled all nodejs/npm/nvm stuff, paths, everything. Just in case. And I installed the v1.1.11.

After that, I opened Herd & tried to install the latest node version. It worked. No logs, no errors. So now my current node version is the latest (the checkbox where it says it's the current node version was checked).

Despite of that, when I tried to do npm i in the project I was developing I got:

npm is not recognized as a name of a cmdlet, function, script file, or executable program.

I said, WTF. But anyways I knew that I cannot actually trust the Herd's GUI in the Windows version. Somehow, in my experience using it, I've already had issues related to GUI saying A when CLI was saying B.

I went to https://herd.laravel.com/docs/windows/1/advanced-usage/node-versions#via-the-cli and I did nvm use v21.7.3.

And that was the last step, I finally did npm i and just worked. 🎉

So I have no clue what is happening internally but I solved it this way, installing nvm manually, then installing node via Herd's GUI & finally, via CLI, doing nvm use v21.7.3.

I hope this can help someone facing this same issue!
And if someone has a better workaround/fix for this, please share it!

@khanra17
Copy link

removing NVM_HOME & NVM_SYMLINK -> then installing Herd, solved the issue for me.

image

@ericmp33
Copy link
Author

@sschlein cool it worked for you. I also did it but in my case didn't solve it 🤷

@halmanza
Copy link

Did you remove only from user variables ? @ericmp33 . I also had to remove these from the system variables section as well.

@ericmp33
Copy link
Author

@halmanza I removed every reference to node, nvm & npm variables from my user & from the system too

@khanra17
Copy link

I installed and uninstalled Herd several times without issue.

But once, I downloaded Node directly (Herd was not installed at that time) and uninstalled Node. Then, when trying to install Herd again, Node was not being installed from Herd.

I uninstalled Herd, cleaned ProgramData/, AppData/, and every possible folder, and cleaned User & System PATHS. Nothing worked.

Then, I noticed NVM_HOME and NVM_SYMLINK. After removing them, I reinstalled Herd and saw the PowerShell popup. After finishing, it indeed installed Node, and everything works!

@sschlein
Copy link
Member

@khanra17 So our of curiousity: Why do you install and uninstall Herd several times in the first place?

@sschlein
Copy link
Member

sschlein commented Jun 4, 2024

This seems to be resolved and so I am closing this issue.

TL;DR;
Herd checks for NVM environment variables in your system and user path. If they are present, it does not install it and assumes that it is already available. For the initial issue, there seems to be a different problem because Herd created the "nvm" directory but did not add any files there, so there might be an issue with the internet connection during the setup – after that, it had an nvm directory and variables in the paths but no actual binaries and that caused the issue.

@sschlein sschlein closed this as completed Jun 4, 2024
@ericmp33
Copy link
Author

ericmp33 commented Jun 4, 2024

If you talk about my case, I didn't have internet connection issues during the installation of it 🤷

@sschlein
Copy link
Member

sschlein commented Jun 4, 2024

Yup, but maybe nvm wasn't available for that time.

@ericmp33
Copy link
Author

ericmp33 commented Jun 4, 2024

Okay, if I have time I'll uninstall Herd once more and install it again to see what happens. Then I'll let you know how it went here ✌️

@sschlein
Copy link
Member

sschlein commented Jun 4, 2024

If you do a clean install, can you use this version with more logging?

Download

Get the logs from %USERPROFILE%\AppData\Roaming\Herd\logs

You can either post the logs here or send them to [email protected]

Thanks for helping us with debugging.

@khanra17
Copy link

@khanra17 So our of curiousity: Why do you install and uninstall Herd several times in the first place?

Installed when needed for laravel project, uninstalled when project finished.
Earlier was using docker for php, mysql so some backnforth

@DannJohnrem
Copy link

I have figure out a solution:

if you have a nvm not connected to herd just uninstall it and restart the laravel herd, after doing that go to 'node' there is a nvm installer button there.

image

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

No branches or pull requests

5 participants