npm / npm/cli

[BUG] npx appears to be broken in latest release

Open
#2,603 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug cmd:exec platform:windows Release 7.x
Dominant language
JavaScript
Stars
10.1k
Forks
4.7k
Avg merge
2d 2h
Merged PRs (30d)
19

Description

Since the latest GA release, most attempts to use npm in Windows are broken. cross-env and npx both no longer work properly and cannot find any of the commands. Both previously worked for cross-platform execution of things like husky and jest. This means our commit hooks are also now broken in Windows.

Current Behavior:

Since the GA release of npx 7.5.2, we cannot execute commands on Windows CLI. npm scripts that previously worked like npx and cross-env no longer function. Commit hooks like husky-run are non-functional.

Where previously working, we now get messages like:

> npx jest --coverage

'jest' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code 1
npm ERR! path C:\Code\nl\node-graphql-utils
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c jest --coverage

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\user\AppData\Local\npm-cache\_logs\2021-02-02T23_50_01_621Z-debug.log
npm ERR! code 1
npm ERR! path C:\Code\nl\node-graphql-utils
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c npx jest --coverage

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\user\AppData\Local\npm-cache\_logs\2021-02-02T23_50_01_653Z-debug.log

and

> git -c user.useConfigOnly=true commit --quiet --allow-empty-message --amend --no-edit
'husky-run' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code 1
npm ERR! path C:\Code\nl\node-graphql-utils
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c husky-run pre-commit

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\user\AppData\Local\npm-cache\_logs\2021-02-03T03_35_51_503Z-debug.log

Expected Behavior:

Core features should work as with v6 unless documented as a breaking change. Documentation also says npx it should prompt to install a package if it doesn't exist.

Steps To Reproduce:
  • npm install -g npm@latest
  • npm install jest --save-dev in project
  • npm install husky --save-dev in project
  • Confirm both are installed with npm ls jest and npm ls husky
  • Attempt npx jest
  • Attempt a git commit on Windows
Environment:
  • OS: Windows 10 10.0.19042
  • Node: 14.15.4
  • npm: 7.5.2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source files or tests are named. Start by reproducing the Windows 10 failure with Node 14.15.4 and npm 7.5.2 using the listed npx, cross-env, and husky commit-hook commands; done means installed project commands and commit hooks work as they did with npm 6.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
cli, operating-systems, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.