beyondcode / herd-community

84 stars 1 forks source link

[Bug]: NVM doesnt install #1027

Open tm69 opened 2 weeks ago

tm69 commented 2 weeks ago

Platform

Windows

Operating system version

Windows 11 Pro (23H2 | 22631.4169)

System architecture

Windows

Herd Version

1.11.0

PHP Version

No response

Bug description

In the node tab doesn't recognize NVM, I reinstalled, erase all directories and remove my system environment variables.

When I reinstall Herd and click Install NVM flashes and doesn't install it

image

and in the herd NVM folder only has these files and doesn't register system environment variables.

image

Steps to reproduce

No response

Relevant log output

No response

isimmons commented 2 weeks ago

Possibly related issue

I did terrible troubleshooting by trying random things and not documenting properly, and caused more issues for myself, but at one point had this exact problem.

So, on a hunch, check if the target of the nodejs symlink in "Program Files" exists and if so, is it pointing to an actual existing node installation in .config/herd/bin/nvm ? After reinstalling herd as you did, if you didn't delete the symlink, it should be pointing at a non-existent node directory.

tm69 commented 2 weeks ago

The symnlink was already deleted and after reinstall Herd and click install nvm doesn´t set the enviroment variables, only create the 3 files on te image above

tm69 commented 2 weeks ago

[2024-09-25 10:20:34.033] [info] Running NVM install command: Start-Process PowerShell -ArgumentList '-NoProfile -ExecutionPolicy Bypass -File "C:\Program Files\Herd\resources\app.asar.unpacked\resources\bin\nvm\install.ps1" -NVM_PATH "C:\Users\x.config\herd\bin\nvm"' -Verb RunAs -Wait [2024-09-25 10:20:34.062] [error] Error occurred in handler for 'herd.install-nvm': [2024-09-25 10:20:34.081] [error] [NodeVersionManager] isInstalled: ExceptionError: Command failed: powershell -Command '"C:\Users\x\.config\herd\bin\nvm\nvm.exe" --version' [2024-09-25 10:20:34.268] [info] [NodeVersionManager] installedNodeVersions: [2024-09-25 10:20:34.268] [info] [NodeVersionManager] parseNodeVersionList: [ '' ] [2024-09-25 10:20:34.268] [info] [NodeVersionManager] installedNodeVersions: ERROR open C:\Users\x.config\herd\bin\nvm\settings.txt: The system cannot find the file specified.

[2024-09-25 10:20:34.268] [info] [NodeVersionManager] parseNodeVersionList: [ '', 'ERROR open C:\Users\x\.config\herd\bin\nvm\settings.txt: The system cannot find the file specified.', '' ]

mpociot commented 2 weeks ago

@tm69 can you try and manually run the install.ps1 script in powershell?

tm69 commented 2 weeks ago

@tm69 can you try and manually run the install.ps1 script in powershell?

@mpociot with administrative permissions or normal?

tm69 commented 2 weeks ago

In unprivileged mode

╰─ .\install.ps1 ─╯ MethodInvocationException: C:\Program Files\Herd\resources\app.asar.unpacked\resources\bin\nvm\install.ps1:9 Line | 9 | [Environment]::SetEnvironmentVariable("NVM_HOME", $NVM_HOME, [Environ … | ~~~~~~~~~~~~~~~~~ | Exception calling "SetEnvironmentVariable" with "3" argument(s): "Requested registry access is not allowed." MethodInvocationException: C:\Program Files\Herd\resources\app.asar.unpacked\resources\bin\nvm\install.ps1:10 Line | 10 | [Environment]::SetEnvironmentVariable("NVM_SYMLINK", $NVM_SYMLINK, [E … | ~~~~~~~~~~~~~~~~~ | Exception calling "SetEnvironmentVariable" with "3" argument(s): "Requested registry access is not allowed." Out-File: C:\Program Files\Herd\resources\app.asar.unpacked\resources\bin\nvm\install.ps1:13 Line | 13 | "PATH=$env:PATH" | Out-File "$NVM_HOME\PATH.txt" | ~~~~~~~~~ | Access to the path 'C:\PATH.txt' is denied. MethodInvocationException: C:\Program Files\Herd\resources\app.asar.unpacked\resources\bin\nvm\install.ps1:18 Line | 18 | [Environment]::SetEnvironmentVariable("PATH", $NewPath, [EnvironmentV … | ~~~~~~~~~~~~~~~~~ | Exception calling "SetEnvironmentVariable" with "3" argument(s): "Requested registry access is not allowed." OperationStopped: C:\Program Files\Herd\resources\app.asar.unpacked\resources\bin\nvm\install.ps1:29 Line | 29 | $NVM_HOME = $a.GetFolder($NVM_HOME).ShortPath | ~~~~~~~~~ | Value does not fall within the expected range. Out-File: C:\Program Files\Herd\resources\app.asar.unpacked\resources\bin\nvm\install.ps1:40 Line | 40 | $content | Out-File -FilePath "$NVM_HOME\settings.txt" -Encoding ASCI … | ~~~~~~~~~~~~~~ | Access to the path 'C:\settings.txt' is denied. &: C:\Program Files\Herd\resources\app.asar.unpacked\resources\bin\nvm\install.ps1:46 Line | 46 | & $NVM_HOME\nvm.exe root "$NVM_HOME" | ~~~~~ | The term '\nvm.exe' is not recognized as a name of a cmdlet, function, script file, or executable program. Check | the spelling of the name, or if a path was included, verify that the path is correct and try again. &: C:\Program Files\Herd\resources\app.asar.unpacked\resources\bin\nvm\install.ps1:49 Line | 49 | & $NVM_HOME\nvm.exe install latest | ~~~~~ | The term '\nvm.exe' is not recognized as a name of a cmdlet, function, script file, or executable program. Check | the spelling of the name, or if a path was included, verify that the path is correct and try again. &: C:\Program Files\Herd\resources\app.asar.unpacked\resources\bin\nvm\install.ps1:52 Line | 52 | & $NVM_HOME\nvm.exe use latest | ~~~~~ | The term '\nvm.exe' is not recognized as a name of a cmdlet, function, script file, or executable program. Check | the spelling of the name, or if a path was included, verify that the path is correct and try again.

Suggestion [3,General]: The command "\nvm.exe" was not found, but does exist in the current location. PowerShell does not load commands from the current location by default (see ''Get-Help about_Command_Precedence'').

If you trust this command, run the following command instead:

With run as administrator

╰─ .\install.ps1 ─╯ OperationStopped: C:\Program Files\Herd\resources\app.asar.unpacked\resources\bin\nvm\install.ps1:29 Line | 29 | $NVM_HOME = $a.GetFolder($NVM_HOME).ShortPath | ~~~~~~~~~ | Value does not fall within the expected range. &: C:\Program Files\Herd\resources\app.asar.unpacked\resources\bin\nvm\install.ps1:46 Line | 46 | & $NVM_HOME\nvm.exe root "$NVM_HOME" | ~~~~~ | The term '\nvm.exe' is not recognized as a name of a cmdlet, function, script file, or executable program. Check | the spelling of the name, or if a path was included, verify that the path is correct and try again. &: C:\Program Files\Herd\resources\app.asar.unpacked\resources\bin\nvm\install.ps1:49 Line | 49 | & $NVM_HOME\nvm.exe install latest | ~~~~~ | The term '\nvm.exe' is not recognized as a name of a cmdlet, function, script file, or executable program. Check | the spelling of the name, or if a path was included, verify that the path is correct and try again. &: C:\Program Files\Herd\resources\app.asar.unpacked\resources\bin\nvm\install.ps1:52 Line | 52 | & $NVM_HOME\nvm.exe use latest | ~~~~~ | The term '\nvm.exe' is not recognized as a name of a cmdlet, function, script file, or executable program. Check | the spelling of the name, or if a path was included, verify that the path is correct and try again.

Suggestion [3,General]: The command "\nvm.exe" was not found, but does exist in the current location. PowerShell does not load commands from the current location by default (see ''Get-Help about_Command_Precedence'').

If you trust this command, run the following command instead:

And when I run as administrator make 2 files in C image

settings.txt

generated in enviroment variables NVM_SYMLINK and add to path C:\Program Files\nodejs without the symlink