Skip to content

[BUG] npm run fails on Windows when project folder is case sensitive #3299

@neilrackett

Description

@neilrackett

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

  1. Open a command prompt or PowerShell window at the location of your project folder
  2. Delete node_modules if it already exists
  3. Make the project folder case sensitive using fsutil.exe file setCaseSensitiveInfo . enable
  4. Run npm i
  5. Try to run any script defined in your package.json file, e.g. npm run build
  6. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingRelease 7.xwork is associated with a specific npm 7 releasecmd:run-scriptrelated to `npm run-script`platform:windowsis Windows-specific

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions