issue_9910_monorepo.tar.gz
Is there an existing issue for this?
This issue exists in the latest npm version
This is not just a request to bump a dependency for a CVE
Current Behavior
If the parent directory path of a monorepo includes a ':' colon character, npm fails to find hoisted files in the monorepo node_modules/.bin directory.
Given a monorepo structure as follows:
parent:directory (note the colon in the name)
|- mono-repo
|- packages
|- @waitem
|- shared-types
with "workspaces": "packages/@waitem/*" defined in the top-level mono-repo directory
and a package.json file in packages/@waitem/shared-types which includes typescript as a dependency, and has a script: "build": "tsc" script
running npm install in the mono-repo directory works as expected, installing the hoisted packages in mono-repo/node_modules
However running npm -w @waitem/shared-types run build after npm install fails with the error message:
npm notice run @waitem/shared-types@0.0.0 build
npm notice run tsc
sh: 1: tsc: not found
npm error Lifecycle script `build` failed with error:
npm error code 127
npm error path /home/waitem/releases/parent:directory/mono-repo/packages/@waitem/shared-types
npm error workspace @waitem/shared-types@0.0.0
npm error location /home/waitem/releases/parent:directory/mono-repo/packages/@waitem/shared-types
npm error command failed
npm error command sh -c tsc
Note that if the parent directory is renamed from 'parent:directory' to 'parent-directory' the command npm -w @waitem/shared-types run build then works correctly
Expected Behavior
npm should be able to locate and run hoisted package bin files when the parent directory path contains a ':' colon character
Steps To Reproduce
- Unpack the attached issue9910_monorepo.tar.gz file
- cd parent:directory/project-name
- Run 'npm install'
- Run "npm -w packages/@waitem/shared-types run build"
- See error:
sh: 1: tsc: not found
From limited testing, it appears that a ':' anywhere in the parent directory path is enough to cause the problem.
Environment
- npm: 12.0.2
- Node.js: v24.19.0
- OS Name: Ubuntu 22.04 LTS
- System Model Name: Dell
- npm config:
; "user" config from /home/waitem/.npmrc
@waitem:registry = "https://npm.pkg.github.com"
//npm.pkg.github.com/:_authToken = (protected)
; node bin location = /home/waitem/.nvm/versions/node/v24.19.0/bin/node
; node version = v24.19.0
; npm local prefix = /home/waitem
; npm version = 12.0.2
; cwd = /home/waitem
; HOME = /home/waitem
; Run `npm config ls -l` to show all defaults.
issue_9910_monorepo.tar.gz
Is there an existing issue for this?
This issue exists in the latest npm version
This is not just a request to bump a dependency for a CVE
Current Behavior
If the parent directory path of a monorepo includes a ':' colon character, npm fails to find hoisted files in the monorepo node_modules/.bin directory.
Given a monorepo structure as follows:
parent:directory (note the colon in the name)
|- mono-repo
|- packages
|- @waitem
|- shared-types
with
"workspaces": "packages/@waitem/*"defined in the top-levelmono-repodirectoryand a
package.jsonfile inpackages/@waitem/shared-typeswhich includes typescript as a dependency, and has a script:"build": "tsc" scriptrunning
npm installin themono-repodirectory works as expected, installing the hoisted packages inmono-repo/node_modulesHowever running
npm -w @waitem/shared-types run buildafternpm installfails with the error message:Note that if the parent directory is renamed from 'parent:directory' to 'parent-directory' the command
npm -w @waitem/shared-types run buildthen works correctlyExpected Behavior
npm should be able to locate and run hoisted package bin files when the parent directory path contains a ':' colon character
Steps To Reproduce
sh: 1: tsc: not foundFrom limited testing, it appears that a ':' anywhere in the parent directory path is enough to cause the problem.
Environment