Skip to content

[BUG] Script with directory iteration does not parse correctly as of 8.13.0 #5195

@nickdeakin

Description

@nickdeakin

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

When running an npm script, in npm 8.14.0 (also 8.13.x) which iterates a directory, the iteration does not happen. The script does not seem to be parsed correctly.

The script with the iteration is:
for /D %D in (*) do (echo installing for %D & cd %D & npm install & cd ..);

This worked up to npm 8.12.2

Expected Behavior

The script is parsed as if it was run directly in cli and the iteration is executed correctly

Steps To Reproduce

  1. In this environment...
  • Windows 10
  • node 16.15.1
  • npm 8.14.0
  1. With this config...
"scripts": {
	"bundle": "npm run install:all",
	"install:all": "for /D %D in (*) do (echo installing for %D & cd %D & npm install & cd ..);"
}
  1. Run '...'
    npm run bundle

  2. See error...
    D was unexpected at this time.

Environment

  • npm: 8.14.0
  • Node.js: 16.15.1
  • OS Name: Windows 10
  • System Model Name: dell precision 3551
  • npm config:
npm config ls
; "user" config from C:\Users\ndeakin\.npmrc                

# using a private corporate registry
  
; node bin location = C:\Program Files\nodejs\node.exe                                 
; node version = v16.15.1                                                              
; npm local prefix = C:\Users\ndeakin\Documents\git\devx\frontend\admin-console        
; npm version = 8.14.0                                                                 
; cwd = C:\Users\ndeakin\Documents\git\devx\frontend\admin-console                     
; HOME = C:\Users\ndeakin                                                              
; Run `npm config ls -l` to show all defaults.     

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingPriority 1high priority issueRelease 8.xwork is associated with a specific npm 8 releaseplatform:windowsis Windows-specific

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions