You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Yesterday: npm install works and packages installed. (Environmental variables as-is) Today: Running npm install generates Unknown command: "C:\Program Files\nodejs\npm"unexpectedly. System change: ordering of environmental variables for Git/bin/bash v system32/bash.exe (unrelated) for another project (since removed in further troubleshooting).
Step 1: Attempt 1: Simple attempt
I uninstalled NodeJs LTS v18 and upgraded to NodeJS and rebooted
Used BulkCrapUninstaller to uninstall/remove traces from registry.
Scanned the registry for any npm or node references
Removed all references in sysdm.cpl (runas:/ Admin) for Environmental Variables
Then:
Rebooted
Installed Git, then NodeJs under Administrator runas/ elevated priviledges.
Ran the commands as below.
Configured the following
Git: c:\Program Files\git
Node: c:\Program Files\nodejs
AppData : c:\AppData\Roaming\npm
Manually copied the c:\Program Files\nodejs\node_modules\npm ==> c:\AppData\Roaming\npm
System Environments Variables and User Environmental Variables (see below)
How often does it reproduce? Is there a required condition?
node -v generates a version output to stdout: v20.10.0 npm -v generates a version output to stdout: v10.2.3
but on Windows npm help => Unknown command: "C:\Program Files\nodejs\npm" npm install => Unknown command: "C:\Program Files\nodejs\npm" or any oither
but in WSL2 (Ubuntu): C:\Windows\System32\Bash.exe npm help => works StdOut npm install => works StdOut
What is the expected behavior? Why is that the expected behavior?
npm commands should execute in Windows 11 from within Windows Terminal (Powershellv7)
However, I have WSL installed and from C:\Windows\System32\bash.exe it runs as expected. WSL was installed over 7 days ago and npm ran as expected and is running as expected..
I use Jetbrains IDEs and use their Run Configurations heavily and these IDE rely on C:\Program Files\nodejs\npm.cmd. (Actually I found out this issue happen that previously running scripts stopped running in this interface). I rely on these IDE Run Configs for current projects.
The script npm in C:\Program Files\nodejs is not being detected.
What do you see instead?
Running npm install or npm help generates Unknown command: "C:\Program Files\nodejs\npm"
Irrespective of Reinstalling NodeJs several times.
Configuring the Environmental Vars and
Ordered the nodejs and npm to top of paths
Added additional USER custom vars
NODE_PATH: directory level
C:\Program Files\nodejs
NODE_EXE: file level
C:\Program Files\nodejs\node.exe
NPM_PATH: directory level
C:\Program Files\nodejs
C:\Program Files\nodejs\node_modules
C:\Program Files\nodejs\node_modules\npm\bin
NODE_EXE: files level
C:\Program Files\nodejs\npm.cmd
C:\Program Files\nodejs\npm
C:\Program Files\nodejs\npx
C:\Program Files\nodejs\npx.cmd
Exceptionally by re-ordering (a failed smoke test)
- Security Intelligence Update for Microsoft Defender Antivirus - KB2267602 (Version 1.403.260.0) - Current Channel (Broad): ): Installed 10/12/23
- Security Intelligence Update for Microsoft Defender Antivirus - KB2267602 (Version 1.403.228.0) - Current Channel (Broad): Installed 09/12/23
Can provide a Belarc Advisory Inventory by private means.
The text was updated successfully, but these errors were encountered:
iPoetDev
changed the title
C:\Program Files\nodejs\npm command not found - suddenly stops for IDE and Windows Terminal, but not WSL Bash.exe. C:\Program Files\nodejs\npm command not found - suddenly stops for IDE and Windows Terminal, but not WSL Bash.exe. (on same system)
Dec 10, 2023
But the behaviour inconsistent AS same command fails in Windows Terminal/Powershell
Further testing: in IDE for further behaviours on going.Need IDE to behave before issue and run configs to behave as expected.
In Webstorm:
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
npm install
Could not determine Node.js install directory
PS D:\Code\CodeInstitute\examples\AlpineTicTacToe>
Would using docker on Windows be a workaround verses using Windows as the native host/Dev container for npm globally with WSL co installed? I think the WSL Node/NPM install is hijacking the Windows node/npm install?
I think, given that I did on first run/execution the WSL Bash.exe (Windows\System32\Bash.exe) from a Window context before this npm concern, there is a side effect of WSL version of node/nom on Windows hijacking the priority execution of the Windows node/npm from the Window kernel over the WSL kernel on Windows.
Now npm runs inside the WSL Bash.exe and not from any other window's shell where command is not found.
marco-ippolito
added
windows
Issues and PRs related to the Windows platform.
npm
Issues and PRs related to the npm client dependency or the npm registry.
labels
Dec 15, 2023
Version
18.15, 20.10
Platform
Microsoft Windows NT 11.0.22621.0 x64
Subsystem
NPM / NPM.cmd
What steps will reproduce the bug?
Yesterday:
npm installworks and packages installed. (Environmental variables as-is)Today: Running
npm installgeneratesUnknown command: "C:\Program Files\nodejs\npm"unexpectedly.System change: ordering of environmental variables for Git/bin/bash v system32/bash.exe (unrelated) for another project (since removed in further troubleshooting).
Step 1: Attempt 1: Simple attempt
NodeJs LTS v18and upgraded toNodeJSand rebootedBulkCrapUninstallerto uninstall/remove traces from registry.Step 2: Attempt 2: Clean Un-/Re- install: Git, Node LTS v20
Then:
Configured the following
c:\Program Files\gitc:\Program Files\nodejsc:\AppData\Roaming\npmc:\Program Files\nodejs\node_modules\npm==>c:\AppData\Roaming\npmHow often does it reproduce? Is there a required condition?
node -vgenerates a version output to stdout:v20.10.0npm -vgenerates a version output to stdout:v10.2.3npm help=>Unknown command: "C:\Program Files\nodejs\npm"npm install=>Unknown command: "C:\Program Files\nodejs\npm"or any oitherC:\Windows\System32\Bash.exenpm help=> works StdOutnpm install=> works StdOutWhat is the expected behavior? Why is that the expected behavior?
npmcommands should execute in Windows 11 from within Windows Terminal (Powershellv7)However, I have WSL installed and from
C:\Windows\System32\bash.exeit runs as expected. WSL was installed over 7 days ago andnpmran as expected and is running as expected..I use Jetbrains IDEs and use their Run Configurations heavily and these IDE rely on
C:\Program Files\nodejs\npm.cmd. (Actually I found out this issue happen that previously running scripts stopped running in this interface). I rely on these IDE Run Configs for current projects.The script
npminC:\Program Files\nodejsis not being detected.What do you see instead?
Running
npm installornpm helpgeneratesUnknown command: "C:\Program Files\nodejs\npm"nodejsandnpmto top of pathsC:\Program Files\nodejsC:\Program Files\nodejs\node.exeC:\Program Files\nodejsC:\Program Files\nodejs\node_modulesC:\Program Files\nodejs\node_modules\npm\binC:\Program Files\nodejs\npm.cmdC:\Program Files\nodejs\npmC:\Program Files\nodejs\npxC:\Program Files\nodejs\npx.cmdExceptionally by re-ordering (a failed smoke test)
Generates : such suggest that the node/npm is detecting the package at some entry point but refuses to use the npm script..
I have spent 4 to 5 hours trying to fix.
Additional information
IDE:
Environmental Variables
$Useris replacer for actual user path. Line breaks added for readability but remove for actual.System Path:
User Path:
MS Security Definitions Updates
Can provide a Belarc Advisory Inventory by private means.
The text was updated successfully, but these errors were encountered: