2

我有一个由两个工作区组成的项目:

  • 客户端(Angular 8)packages/client
  • 服务器(NestJS)在packages/server

这是根package.json

{
  "name": "workspace-demo",
  "version": "0.0.1",
  "license": "MIT",
  "private": true,
  "workspaces": {
    "packages": [
      "packages/*"
    ]
  }
}

这是问题所在:出于某种原因,在向客户端和/或服务器添加了一些依赖项(来自 Angular 和 NestJS 的依赖项)之后,Yarn 决定将依赖项移动@nestjspackages/server/node_modules而不是将其放在node_modules文件夹中。那就是将依赖项从node_modules/@nestjs移至packages/server/node_modules/@nestjs

内容packages/client/package.json

{
  "name": "client",
  "version": "0.0.1",
  "private": true,
  "dependencies": {
    "@angular/animations": "~8.2.7",
    "@angular/common": "~8.2.7",
    "@angular/compiler": "~8.2.7",
    "@angular/core": "~8.2.7",
    "@angular/forms": "~8.2.7",
    "@angular/platform-browser": "~8.2.7",
    "@angular/platform-browser-dynamic": "~8.2.7",
    "@angular/router": "~8.2.7"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.803.5",
    "@angular/cli": "~8.3.5",
    "@angular/compiler-cli": "~8.2.7",
    "@angular/language-service": "~8.2.7",
    "@types/node": "~8.9.4",
    "typescript": "~3.5.3"
  }
}

内容packages/server/package.json

{
  "name": "server",
  "version": "0.0.1",
  "license": "MIT",
  "dependencies": {
    "@nestjs/common": "^6.7.2",
    "@nestjs/core": "^6.7.2",
    "@nestjs/platform-express": "^6.7.2",
    "reflect-metadata": "^0.1.13",
    "rxjs": "^6.5.3"
  },
  "devDependencies": {
    "@types/express": "^4.17.1",
    "@types/node": "^12.7.7"
  }
}
4

0 回答 0