-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Closed
Labels
Bugthing that needs fixingthing that needs fixingNeeds Triageneeds review for next stepsneeds review for next stepsRelease 8.xwork is associated with a specific npm 8 releasework is associated with a specific npm 8 release
Description
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
NPM workspaces install dependencies at different levels of the app. When things are require
d you can get errors because things aren't at the same level.
When root dependency tries to require nested dependency there're issues. While you can often hoist dependencies up this is not always desirable.
It does not work if nested calls to root that tries to find a nested dependency, require.resolve.paths
show that cwd
isn't included on those paths.
Expected Behavior
require
works as long in, either way, no matter where npm decides to install the dependency, or we should be able to set where packages are installed.
Steps To Reproduce
- Need to have workspaces
- Have dependencies that live in different places (root vs package)
- A dependency that lives on root that, called from package require a nested package
This is reproducible in this small repository: https://github.com/Antonio-Laguna/node-workspaces-bug
Environment
- npm: 8.11.0
- Node.js: v16.15.1
- OS Name: macOS 13.0
- System Model Name: Macbook Pro
- npm config:
; "user" config from /Users/alaguna/.npmrc
//registry.npmjs.org/:_authToken = (protected)
node_gyp = "usr/local/bin/node-gyp"
tag-version-prefix = ""
; node bin location = /Users/alaguna/.nvm/versions/node/v16.15.1/bin/node
; node version = v16.15.1
; npm local prefix = /Users/alaguna
; npm version = 8.11.0
; cwd = /Users/alaguna
; HOME = /Users/alaguna
; Run `npm config ls -l` to show all defaults.
noahtallen
Metadata
Metadata
Assignees
Labels
Bugthing that needs fixingthing that needs fixingNeeds Triageneeds review for next stepsneeds review for next stepsRelease 8.xwork is associated with a specific npm 8 releasework is associated with a specific npm 8 release