Reputation: 91
I'm having trouble running my app with NPM 7 Workspaces. I am expecting an npm install
from the root folder to create a node_modules
folder for each of my workspaces, similar to Lerna. However, when I run npm install
at the root, I only get one node_modules
, at the root level. Is this expected?
Example structure before npm i
:
.
├── package.json -> { "workspaces": ["packages/*"] }
└── packages
├── a
│ ├── index.js
│ └── package.json
├── b
│ ├── index.js
│ └── package.json
└── c
├── index.js
└── package.json
Example structure after npm i
(note only one package-lock.json
/node_modules
):
.
├── package.json -> { "workspaces": ["packages/*"] }
├── **node_modules**
├── **package-lock.json**
└── packages
├── a
│ ├── index.js
│ └── package.json
├── b
│ ├── index.js
│ └── package.json
└── c
├── index.js
└── package.json
Node version: 16.4.2
NPM version: 7.18.1
Upvotes: 4
Views: 2968
Reputation: 91
Update: After messing around a with a million things, I finally went and deleted the project and recloned it. It worked after this. I believe it was due to the fact that I was on an old node/npm version when I originally cloned the project. Must have been some funky state lingering around there. Anyway hope this helps anyone with the same problem!
Upvotes: 4