Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Migration from Angular 6 to Angular 7 cause error - Can't resolve 'core-js/es7/reflect'

Global Angular CLI: 7.3.8
Node v10.15.3
NPM 6.4.1
macos

I'm getting this error on npm start

ERROR in ./node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/jit-polyfills.js Module not found: Error: Can't resolve 'core-js/es7/reflect' in '/Users/XXX/projects/XXX/node_modules/@angular-devkit/build-angular/src/angular-cli-files/models' ERROR in ./src/polyfills.ts Module not found: Error: Can't resolve 'core-js/es7/reflect' in '/Users/XXX/projects/XXX/src'

like image 272
Dmitry Grinko Avatar asked Nov 29 '22 21:11

Dmitry Grinko


1 Answers

To solve this issue I've added the following paths to compilerOptions in tsconfig.json

{
  "compileOnSave": false,
  "compilerOptions": {
    "paths": {
      "core-js/es7/reflect": [
        "node_modules/core-js/proposals/reflect-metadata",
      ],
      "core-js/es6/*": ["node_modules/core-js/es"]
    },
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2017",
      "dom"
    ]
  }
}
like image 143
Dmitry Grinko Avatar answered Dec 04 '22 05:12

Dmitry Grinko