npm 将依赖项安装在错误的目录中
我创建了一个具有工作区的节点项目,项目结构如下所示:
/package.json
{
"name": "root",
"workspaces": ["./child"]
}
/child/package.json
{
"name": "child",
"dependencies": {
"@angular/compiler": "^13.1.2",
"@angular/router": "^13.1.2"
}
}
运行 npm install
时,它会安装 @angular/compiler
在根 node_modules 目录中,这是预期的行为。 但它在child/node_modules中安装@angular/router
,它也应该安装在根node_modules中
,它的依赖项如rxjs
甚至安装在子目录中没有其他版本的相同软件包
该项目是在干净且空的文件夹中创建的,并且我清除了 npm 缓存
I created a node project that has a workspace, the project structure looks like:
/package.json
{
"name": "root",
"workspaces": ["./child"]
}
/child/package.json
{
"name": "child",
"dependencies": {
"@angular/compiler": "^13.1.2",
"@angular/router": "^13.1.2"
}
}
when running npm install
it installs @angular/compiler
in the root node_modules dir which is the expected behavior.
but it installs @angular/router
in child/node_modules, it should be installed in the root node_modules
also, the dependencies of it such as rxjs
are installed in the child dir even no other versions of the same packages
the project is created in a clean and empty folder, and I cleared the npm cache
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论