[BUG] npm run fails on Windows when project folder is case sensitive
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 10.1k
- Forks
- 4.7k
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 19
Description
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
When case sensitivity is enabled, all scripts, e.g. npm run build, will fail with the error:
'module_name' is not recognized as an internal or external command
Where module_name is the name of the the module called by the script, e.g. webpack or cross-env
Expected Behavior
npm run should run scripts as normal, unaffected by the case sensitivity setting of the project folder (or its subfolders).
Steps To Reproduce
- Open a command prompt or PowerShell window at the location of your project folder
- Delete
node_modulesif it already exists - Make the project folder case sensitive using
fsutil.exe file setCaseSensitiveInfo . enable - Run
npm i - Try to run any script defined in your
package.jsonfile, e.g.npm run build - The script fails with an error similar to
'module_name' is not recognized as an internal or external command
As an alternative to steps 1-4, you could also recursively apply case sensitivity to the content of your project folder using this PowerShell command:
(Get-ChildItem -Recurse -Directory).FullName | ForEach-Object {fsutil.exe file setCaseSensitiveInfo $_ enable}
Environment
- OS: Windows 10 Pro (Microsoft Windows NT 10.0.19042.0 x64)
- Node: 14.17.0
- npm: 7.14.0
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure on Windows 10 using a package.json script such as npm run build, after enabling case sensitivity with fsutil.exe or the provided PowerShell command. Start at the npm run entry point and trace how script modules such as webpack or cross-env are resolved; done means scripts run normally in a case-sensitive project folder.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100