在我的 Monorepo 中,我有一个包,我希望它的所有依赖项都在其 node_modules 中。
但是,无论我做什么,它的 node_modules 都保持为空。
所以,为了解决我的问题,我使用以下设置重现了该问题。
/
package.json
lerna.json
node_modules
packages/
A/
node_modules
package.json
index.ts
B/
node_modules
package.json
index.ts
我已经为此创建了一个存储库!
主要的 package.json
{
"name": "A-B-test",
"private": true,
"workspaces": {
"packages": ["packages/*"],
"nohoist": [ "**/B" ]
},
...
"devDependencies": {
"lerna": "^3.13.4"
}
}
B/package.json
看起来像是
{
"name": "@scaljeri/B",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"angular": "^1.7.8"
},
"devDependencies": {
"browserify": "^16.2.3",
"typescript": "^3.5.2"
}
}
现在当我在项目的根目录中运行yarn
时,所有依赖项都会安装在根目录下的node_modules
中。
yarn版本:1.16.0 node版本:12.4.0
有什么建议可能是问题所在?