2

I am trying to update from Angular 8 to 9 (Ivy). I am trying to consume a shared library which is compiled using Angular 8. I have added:

"postinstall":"ngcc"

in my package.json and tried running ngcc. Everytime it gives me the following error:

TypeError: fn(...).finally is not a function
      at AsyncLocker.<anonymous> (...../node_modules/@angular/compiler-cli/ngcc/src/locking/async_locker.js:44:63)
        at step (.../node_modules/tslib/tslib.js:139:27)
        at Object.next (.../node_modules/tslib/tslib.js:120:57)
        at fulfilled (.../node_modules/tslib/tslib.js:110:62)
        at <anonymous>
        at process._tickCallback (internal/process/next_tick.js:189:7)
        at Function.Module.runMain (module.js:696:11)
        at startup (bootstrap_node.js:204:16)
        at bootstrap_node.js:625:3
    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    npm ERR! project-ng@1.0.0 postinstall: `ngcc`
    npm ERR! Exit status 1
    npm ERR! 

I have tried deleting node_modules, doing a fresh npm install and trying but the error persists.

Here is my tsconfig.json

{
  "compilerOptions": {
    "target": "ESNext",
    "module": "ES2015",
    "lib": [
      "es2015",
      "dom"
    ],
    "moduleResolution": "node",
    "sourceMap": true,
    "declaration": true,
    "importHelpers": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": false,
    "suppressImplicitAnyIndexErrors": true,
    "typeRoots": [
      "node_modules/@types"
    ]
  },
  "exclude": [
    "node_modules",
    "dist",
    "src/**/*.spec.ts",
    "src/**/*.e2e.ts",
    "**/*.ngfactory.ts"
  ],
  "angularCompilerOptions": {
    "entryModule": "./src/app/app.module#AppModule",
    "skipMetadataEmit": true
  }
}

Any help towards this would be welcome. Thanks.

userx
  • 1,083
  • 5
  • 18
  • 36

1 Answers1

4

I had a similar error message when using npm install to reinstall an Angular 9 app from source control.

In my case the issue was caused by having an older version of Node.

Installing the latest version of Node fixed the issue.

Simon H
  • 508
  • 1
  • 5
  • 18