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

I’m submitting a…

[X] Other... Please describe:
Issue with build

Current behavior

When i npm run build my project in a docker environment i get the following error.

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.

Expected behavior

For it to build successfully, this error is stopping that.

Minimal reproduction of the problem with instructions

docker build -t demo:production --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


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

What is the motivation / use case for changing the behavior?


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

- [ X] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
For Tooling issues:
- Node version: XX  v9.8.0
- Platform:  Mac

TS Config 

  "compileOnSave": false,
  "compilerOptions": {
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "typeRoots": [
    "lib": [

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 36
  • Comments: 19 (3 by maintainers)

Most upvoted comments

This issue was fixed in the latest version of RxJS. Just run this command to update, then you should be able to compile your project:

npm install --save rxjs

There could be 2 solutions:

  1. Go to rxjs/internal/symbol/observable.d.ts and hack:
declare global  {
    interface SymbolConstructor {
        observable: symbol;


declare global  {
    interface SymbolConstructor {
        readonly observable: symbol;
  1. Or, in tsconfig.json, add this:
		"skipLibCheck": true

I would prefer the 2nd.

Fix is here.

I was using @types/node 10.3.0 i had to downgrade. Im now using @types/node": "~8.9.4"

Tested, the below works.

    "rxjs": "6.2.1",
    "@types/node": "10.3.6"

I fixed the problem already.

What I did:

  • I installed the working version for rxjs 6.2.0 and @types/node 10.1.4
  • Push the working project and jenkins started to build
  • It failed at the test pipeline with the error message, that I’m using wrong import paths e.g. rxjs/add/observable/of
  • Fixing all tests with correct imports, e.g. import { of } from "rxjs";
  • Updates to rxjs 6.2.1 and @types/node 10.5.2
  • Pushed again and the build worked

Try this fix: In your package.json set this dependency > "@types/node": "10.0.4" > npm i > ng serve.

I have still the same problem, my dependency versions are the latest:

    "rxjs": "6.2.1",
    "@types/node": "10.3.6"
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(169,14): error TS2687: All declarations of 'observable' must have identical modifiers.

Dup of (being tracked here mentioned in the issue), not related to angular.

@petercunha answer solve this issue for me. 👍