我有一个Angualr 6项目,我试图运行以下命令npm run build
。如何显示以下错误消息。
ERROR in node_modules/rxjs/internal/symbol/observable.d.ts(4,9): error TS2687: All declarations of 'observable' must have identical modifiers.
node_modules/@types/node/index.d.ts(167,14): error TS2687: All declarations of 'observable' must have identical modifiers.
Angular Version
Angular CLI: 6.0.0
Node: 9.8.0
OS: darwin x64
Angular: 6.0.0
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, http, language-service, material, platform-browser
... platform-browser-dynamic, router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.6.0
@angular-devkit/build-angular 0.6.0
@angular-devkit/build-optimizer 0.6.0
@angular-devkit/core 0.6.0
@angular-devkit/schematics 0.6.0 (cli-only)
@angular/flex-layout 6.0.0-beta.15
@ngtools/webpack 6.0.0
@schematics/angular 0.6.0 (cli-only)
@schematics/update 0.6.0
rxjs 6.1.0
typescript 2.7.2
webpack 4.6.0
忘记提及只发生在我的码头图片中。
docker build -t $IMG --build-arg env=production .
# Stage 0 - Pre-requisite: Based On Node.js to BUILD and compile Demo Angular App.
FROM node:8.11.2 as node
WORKDIR /app
COPY package.json /app/
RUN npm install
COPY ./ /app/
ARG env
RUN npm run build -- --configuration $env
# Stage 1 - Based On Nginx to have ONLY a compiled and PRODUCTION ready build.
FROM nginx:1.14
COPY --from=node /app/dist/ /usr/share/nginx/html
COPY ./nginx-custom.conf /etc/nginx/conf.d/default.conf
答案 0 :(得分:20)
将@ types / node更新为10.3.0后出现同样的问题。降级到10.1.4版后,一切正常。我认为rxjs必须更新才能使用最新的@ types / node版本。所以目前,只需使用旧版本:
Animal
更新:已完成对RxJS的修复 - > https://github.com/ReactiveX/rxjs/pull/3773。现在他们只需要合并更改并发布新版本。
答案 1 :(得分:0)
我在使用较低版本的节点时遇到了同样的问题。
修复它的目的是:
转到有问题的 observable.d.ts
,在我的情况下是:
node_modules/angular-datatables/node_modules/rxjs/internal/symbol/observable.d.ts
改变:
declare global {
interface SymbolConstructor {
readonly observable: symbol;
}
}
到:
declare global {
interface SymbolConstructor {
observable: symbol;
}
}
我想反之亦然。