在`yarn install`之后,Angular 4 app构建错误

时间:2017-09-25 15:06:14

标签: angular npm angular-cli yarnpkg

我有一个使用Angular CLI创建的应用程序,我决定从npm转移到yarn。但我无法使用ng build构建项目,或者在使用yarn安装依赖项后使用ng serve启动项目。

这是ng --version命令返回的内容:

@angular/cli: 1.0.3
node: 6.11.0
os: win32 x64
@angular/animations: 4.4.3
@angular/common: 4.4.3
@angular/compiler: 4.4.3
@angular/core: 4.4.3
@angular/forms: 4.4.3
@angular/http: 4.4.3
@angular/platform-browser: 4.4.3
@angular/platform-browser-dynamic: 4.4.3
@angular/router: 4.4.3
@angular/cli: 1.0.3
@angular/compiler-cli: 4.4.3

删除节点模块并使用npm install再次安装它们后,一切都按预期工作,npm list --local --depth=0之后我可以看到:

+-- @angular/animations@4.4.3
+-- @angular/cli@1.0.3
+-- @angular/common@4.4.3
+-- @angular/compiler@4.4.3

...

+-- moment@2.18.1
+-- ngx-bootstrap@1.9.3
+-- protractor@5.1.2
+-- rxjs@5.4.3
+-- ts-node@2.0.0
+-- tslint@5.7.0
+-- typescript@2.5.2
`-- zone.js@0.8.17

yarn install npm list --local --depth=0返回后:

+-- UNMET DEPENDENCY @angular/animations@4.4.3
| `-- tslib@1.7.1
+-- UNMET DEPENDENCY @angular/common@4.4.3
| `-- tslib@1.7.1
+-- UNMET DEPENDENCY @angular/compiler@4.4.3

...

| `-- moment@2.18.1
+-- UNMET DEPENDENCY fullcalendar-scheduler@1.7.1
| +-- fullcalendar@3.5.1
| +-- jquery@3.2.1
| `-- moment@2.18.1
+-- UNMET DEPENDENCY lodash@4.17.4
+-- UNMET DEPENDENCY moment@2.18.1
+-- UNMET DEPENDENCY ngx-bootstrap@1.9.3
+-- UNMET DEPENDENCY rxjs@5.4.3
| `-- symbol-observable@1.0.4
`-- UNMET DEPENDENCY zone.js@0.8.17

上面的命令还返回有关缺失包的信息:

npm ERR! missing: @angular/animations@4.4.3, required by atomiumplus-angular@0.0.0
npm ERR! missing: @angular/common@4.4.3, required by atomiumplus-angular@0.0.0
npm ERR! missing: @angular/compiler@4.4.3, required by atomiumplus-angular@0.0.0

...

npm ERR! missing: tslib@1.7.1, required by @angular/forms@4.4.3
npm ERR! missing: tslib@1.7.1, required by @angular/http@4.4.3
npm ERR! missing: tslib@1.7.1, required by @angular/platform-browser@4.4.3
npm ERR! missing: tslib@1.7.1, required by @angular/platform-browser-dynamic@4.4.3
npm ERR! missing: tslib@1.7.1, required by @angular/router@4.4.3
npm ERR! missing: moment@2.18.1, required by @types/moment@2.13.0
npm ERR! missing: jquery@3.2.1, required by floating-scroll@2.3.1
npm ERR! missing: jquery@3.2.1, required by fullcalendar@3.5.1
npm ERR! missing: moment@2.18.1, required by fullcalendar@3.5.1
npm ERR! missing: fullcalendar@3.5.1, required by fullcalendar-scheduler@1.7.1
npm ERR! missing: jquery@3.2.1, required by fullcalendar-scheduler@1.7.1
npm ERR! missing: moment@2.18.1, required by fullcalendar-scheduler@1.7.1
npm ERR! missing: symbol-observable@1.0.4, required by rxjs@5.4.3

我想补充一点,我也尝试过最新版本的纱线(1.1.0)和旧版本(1.0.1)。

如何正确安装纱线的依赖关系?

0 个答案:

没有答案