我正在创建一个依赖于模块的应用程序。应用程序的文件结构是......
demo-app
|
|----package.json("workspaces": ["module-core/packages/*","src/packages/*" ])
|----src/
| |---packages/
| |---package.json ("workspaces": ["packages/*"])
| |---module-a
| |---package.json("name":"@app/module-a","private":true, "workspaces": ["packages/*"])
| |---module-b
| |---package.json("name":"@app/module-b","private":true, "workspaces": ["packages/*"])
|
|----module-core/
| |---package.json ("workspaces": ["packages/*"])
| |---packages/
| |---core-a
| |---package.json("name":"@app/core-a","private":true, "workspaces": ["packages/*"])
| |---core-b
| |---package.json("name":"@app/core-b","private":true, "workspaces": ["packages/*"])
下面,
@app/module-a
依赖于 @app/core-a
而 @app/module-b
依赖于 {{1} }
我在演示应用 @app/core-b
中创建了一个工作区。
运行"workspaces": ["module-core/packages/*","src/packages/*"]
时出现提示错误yarn install
。
是否在工作区管理中缺失?
答案 0 :(得分:1)
我只需启用属性"private":true
file:demo-app / package.json
{
"version": "1.0.0",
"private": true,
"workspaces": ["module-core/packages/*","src/packages/*"]
......
......
}
注意:工作区中的包的顺序很重要。