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] npm run <whatever-script> is not recognized as an internal or external command #1770

Closed
halcwb opened this issue Sep 6, 2020 · 1 comment
Labels
Bug thing that needs fixing Release 6.x work is associated with a specific npm 6 release

Comments

@halcwb
Copy link

halcwb commented Sep 6, 2020

Current Behavior:

With a fresh install of node and npm on a windows 10 machine using nvm, I have the following issue:

Whatever script I want to run using:

npm run <whatever script>

I get (listing from the debug log):

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'C:\Program Files\nodejs\node.exe',
1 verbose cli 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'storybook'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestorybook', 'storybook', 'poststorybook' ]
5 info lifecycle [email protected]prestorybook: [email protected]
6 info lifecycle [email protected]
storybook: [email protected]
7 verbose lifecycle [email protected]storybook: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]
storybook: PATH: C:\Users<USER>\AppData\Roaming\nvm\v14.9.0\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Development\lab\storybook\story-book\node_modules.bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users<USER>\bin;C:\Program Files (x86)\Razer Chroma SDK\bin;C:\Program Files\Razer Chroma SDK\bin;C:\Program Files (x86)\Razer\ChromaBroadcast\bin;C:\Program Files\Razer\ChromaBroadcast\bin;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\iCLS;C:\Program Files\Intel\Intel(R) Management Engine Components\iCLS;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Git\cmd;C:\Program Files\dotnet;C:\Users<USER>\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Program Files\Microsoft SQL Server\130\Tools\Binn;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\ProgramData\chocolatey\bin;C:\Program Files\Intel\WiFi\bin;C:\Program Files\Common Files\Intel\WirelessCommon;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\PuTTY;C:\Program Files\CMake\bin;C:\Users<USER>\AppData\Local\Microsoft\WindowsApps;C:\Users<USER>.dotnet\tools;C:\Program Files\PostgreSQL\11\bin;C:\Program Files\Cmder;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files\Docker\Docker\resources\bin;C:\ProgramData\DockerDesktop\version-bin;%NVM_HOME%;%NVM_SYMLINK%;C:\Program Files (x86)\Razer Chroma SDK\bin;C:\Program Files\Razer Chroma SDK\bin;C:\Program Files (x86)\Razer\ChromaBroadcast\bin;C:\Program Files\Razer\ChromaBroadcast\bin;C:\ProgramData\DockerDesktop\version-bin;C:\Program Files\Docker\Docker\Resources\bin;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\iCLS;C:\Program Files\Intel\Intel(R) Management Engine Components\iCLS;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Git\cmd;C:\Program Files\dotnet;C:\Users<USER>\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Program Files\Microsoft SQL Server\130\Tools\Binn;C:\WINDOWS\system32;C:\WINDOWS;C:;C:\Users<USER>\AppData\Local\Microsoft\WindowsApps;C:\Users<USER>\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users<USER>.dotnet\tools;C:\Users<USER>\AppData\Roaming\nvm;C:\Program Files\nodejs
9 verbose lifecycle [email protected]storybook: CWD: C:\Development\lab\storybook\story-book
10 silly lifecycle [email protected]
storybook: Args: [ '/d /s /c', 'start-storybook -p 6006 -s public' ]
11 silly lifecycle [email protected]storybook: Returned: code: 1 signal: null
12 info lifecycle [email protected]
storybook: Failed to exec storybook script
13 verbose stack Error: [email protected] storybook: start-storybook -p 6006 -s public
13 verbose stack Exit status 1
13 verbose stack at EventEmitter. (C:\Users<USER>\AppData\Roaming\nvm\v14.9.0\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:314:20)
13 verbose stack at ChildProcess. (C:\Users<USER>\AppData\Roaming\nvm\v14.9.0\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:314:20)
13 verbose stack at maybeClose (internal/child_process.js:1047:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
14 verbose pkgid [email protected]
15 verbose cwd C:\Development\lab\storybook\story-book
16 verbose Windows_NT 10.0.19041
17 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "run" "storybook"
18 verbose node v14.9.0
19 verbose npm v6.14.8
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] storybook: start-storybook -p 6006 -s public
22 error Exit status 1
23 error Failed at the [email protected] storybook script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

When I directly execute the script by (in the above example: storybook):

node_modules/.bin/start-storybook -p 6006 -s public

It seems that with npm run, the base path where the command is ran, is used, and the working directory is not set to the C:\Development\lab\storybook\story-book\node_modules\.bin folder. Note: the folder does exist in the PATH! (see listing above).

Everything works.

Expected Behavior:

The same behavior of npm run compared with directly running the script from the .bin folder.

Steps To Reproduce:

A fresh install of node using NVM4W on a W10 machine.

Environment:

Runtime Environment:
OS Name: Windows
OS Version: 10.0.19041
OS Platform: Windows
RID: win10-x64

using [email protected]
using [email protected]

nvm version: 1.1.7

@halcwb halcwb added Bug thing that needs fixing Needs Triage needs review for next steps Release 6.x work is associated with a specific npm 6 release labels Sep 6, 2020
@darcyclarke darcyclarke removed the Needs Triage needs review for next steps label Feb 13, 2021
@darcyclarke
Copy link
Contributor

npm v6 is no longer in active development; We will continue to push security releases to v6 at our team's discretion as-per our Support Policy.

If your bug is preproducible on v7, please re-file this issue using our new issue template.

If your issue was a feature request, please consider opening a new RRFC or RFC. If your issue was a question or other idea that was not CLI-specific, consider opening a discussion on our feedback repo

Closing: This is an automated message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Release 6.x work is associated with a specific npm 6 release
Projects
None yet
Development

No branches or pull requests

2 participants