error TS2687: All declarations of 'observable' must have identical modifiers

  • A+
Category:Languages

I have an Angualr 6 project and im trying to run the following command npm run build. How the below error message appears.

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 

Forgot to mention is only happening in my docker image.

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 

 


Had the same issue after updating @types/node to 10.3.0. After downgrading to version 10.1.4 everything is working again. I think rxjs has to be updated to work with the newest @types/node version. So at the moment, just use the older version:

npm install @types/node@10.1.4 

UPDATE: The fix on RxJS is already done -> https://github.com/ReactiveX/rxjs/pull/3773 . Now they just have to merge the changes and publish the new version.

Comment

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: