New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error due to reference to types core-js #62

Closed
davinkevin opened this Issue Oct 30, 2016 · 13 comments

Comments

Projects
None yet
@davinkevin
Copy link

davinkevin commented Oct 30, 2016

Hello,

I'm working on the tour of heroes, implementing it with the AngularCLI and the last version of angular (2.1.0) => https://github.com/davinkevin/Angular2-TourOfHeroes.

So, at the part6 of the TourOfHeroes, I install the in-memory-web-api, but after serving the app I am facing the following error :

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/angular-in-memory-web-api/in-memory-backend.service.d.ts:1:0
Cannot find type definition file for 'core-js'.

The line 1 of the file https://github.com/angular/in-memory-web-api/blob/master/in-memory-backend.service.d.ts#L1 try to load the type file for core-js, but it is only a dev dependency, so not present in my project.

If I add this by installing with npm i -D @types/core-js I have a lot more errors, due to conflicts with es2015.core types definition of Typescript.

** NG Live Development Server is running on http://localhost:4200. **
4569ms building modules
34ms sealing
0ms optimizing
0ms basic module optimization
78ms module optimization
1ms advanced module optimization
12ms basic chunk optimization
0ms chunk optimization
3ms advanced chunk optimization
1ms module and chunk tree optimization
127ms module reviving
9ms module order optimization
4ms module id optimization
3ms chunk reviving
0ms chunk order optimization
11ms chunk id optimization
59ms hashing
0ms module assets processing
165ms chunk assets processing
3ms additional chunk assets processing
0ms recording
0ms additional asset processing
1341ms chunk asset optimization
1050ms asset optimization
42ms emitting
Hash: 0f90a2d2ddfcb98dd1e0
Version: webpack 2.1.0-beta.25
Time: 7531ms
           Asset       Size  Chunks             Chunk Names
  main.bundle.js    3.09 MB    0, 2  [emitted]  main
styles.bundle.js    10.7 kB    1, 2  [emitted]  styles
       inline.js    5.53 kB       2  [emitted]  inline
        main.map    3.21 MB    0, 2  [emitted]  main
      styles.map    14.8 kB    1, 2  [emitted]  styles
      inline.map    5.59 kB       2  [emitted]  inline
      index.html  485 bytes          [emitted]

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:21:13
Duplicate identifier 'PropertyKey'.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:85:4
All declarations of 'name' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:145:4
Subsequent variable declarations must have the same type.  Variable '[Symbol.unscopables]' must be of type '{ copyWithin: boolean; entries: boolean; fill: boolean; find: boolean; findIndex: boolean; keys: ...', but here has type 'any'.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:262:4
All declarations of 'flags' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:276:4
All declarations of 'EPSILON' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:311:4
All declarations of 'MAX_SAFE_INTEGER' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:318:4
All declarations of 'MIN_SAFE_INTEGER' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:457:4
Subsequent variable declarations must have the same type.  Variable '[Symbol.toStringTag]' must be of type '"Symbol"', but here has type 'string'.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:457:4
All declarations of '[Symbol.toStringTag]' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:464:4
All declarations of 'prototype' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:492:4
All declarations of 'hasInstance' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:498:4
All declarations of 'isConcatSpreadable' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:504:4
All declarations of 'iterator' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:510:4
All declarations of 'match' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:516:4
All declarations of 'replace' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:522:4
All declarations of 'search' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:528:4
All declarations of 'species' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:534:4
All declarations of 'split' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:540:4
All declarations of 'toPrimitive' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:546:4
All declarations of 'toStringTag' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:552:4
All declarations of 'unscopables' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:609:4
Subsequent variable declarations must have the same type.  Variable '[Symbol.toStringTag]' must be of type '"Math"', but here has type 'string'.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:609:4
All declarations of '[Symbol.toStringTag]' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:613:4
Subsequent variable declarations must have the same type.  Variable '[Symbol.toStringTag]' must be of type '"JSON"', but here has type 'string'.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:613:4
All declarations of '[Symbol.toStringTag]' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:628:4
All declarations of 'size' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:634:4
All declarations of 'prototype' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:645:4
All declarations of 'size' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:651:4
All declarations of 'prototype' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:666:4
All declarations of 'prototype' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:680:4
All declarations of 'prototype' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:692:4
All declarations of 'value' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/@types/core-js/index.d.ts:804:4
All declarations of 'prototype' must have identical modifiers.

ERROR in [default] /Users/kevin/Workspace/Angular2-TourOfHeroes/node_modules/typescript/lib/lib.es2015.core.d.ts:17:13
Duplicate identifier 'PropertyKey'.
Child html-webpack-plugin for "index.html":
         Asset     Size  Chunks       Chunk Names
    index.html  2.82 kB       0
webpack: bundle is now VALID.

What can we do to suppress this error ?

Thanks ;)

@maximeburri

This comment has been minimized.

Copy link

maximeburri commented Oct 31, 2016

The problem seems to come from the line /// <reference types="core-js" /> of in-memory-backend.service.d.ts.
I don't know the utility of this line but its deletion seems to fix the problem.

@davinkevin

This comment has been minimized.

Copy link

davinkevin commented Nov 1, 2016

Yeah, removing it fix the problem...

But the problem is worse than I though, because it cause an error during the ng serve --aot true and a corrupted build with ng build --aot true.

@cqst

This comment has been minimized.

Copy link

cqst commented Nov 2, 2016

error appears since "angular-in-memory-web-api": "0.1.14"

try to replace with "angular-in-memory-web-api": "0.1.13" in package.json

fix pb for me

davinkevin referenced this issue Nov 2, 2016

davinkevin added a commit to davinkevin/in-memory-web-api that referenced this issue Nov 2, 2016

fix(typings): remove reference to typings which cause error
When we use this lib a dependency in an angular2 project, the system can't find the typings and this breaks all the --aot operation done with the CLI (ng serve, ng build...). Full description of the issue in angular#62

Close angular#62
@tomwanzek

This comment has been minimized.

Copy link

tomwanzek commented Nov 3, 2016

I experienced the same issue with missing core-js typings after upgrading an angular-cli beta.18 project to beta.19-3. Thx @cqst. for now, reverting back to "angular-in-memory-web-api": "0.1.13" fixed the issue.

@pulsar256

This comment has been minimized.

Copy link

pulsar256 commented Nov 9, 2016

Downgrading to .18 did not help (re: ng-lightning/ng-lightning#265)

ᐅ rm node_modules -Rfv
ᐅ yarn install
ᐅ ng version
angular-cli: 1.0.0-beta.18
node: 7.1.0
os: linux x64
ᐅ ng build
(...)
Error in bail mode: [default] /(...)/node_modules/ng-lightning/config/config.d.ts:1:0 
Cannot find type definition file for 'core-js'.
(...)

workaround by removing the core-js reference from the affected dependencies (ng-lightning in my case) could be verified.

@rochavic

This comment has been minimized.

Copy link

rochavic commented Nov 10, 2016

I had the same issue...

My environment:

angular-cli: 1.0.0-beta.19-3
node: 6.8.1
os: win32 x64

Steps to fix Tour of Heroes with angular-cli (in my case):

1 - npm i angular-in-memory-web-api
2 - npm i @types/core-js
3 - Edit package.json file and add the dependency: angular-in-memory-web-api": "0.1.14"
4 - On tsconfig.json, change lib settings to: "lib": ["es5", "dom"],

The trick: http://blog.mgechev.com/2016/03/28/ambient-type-definitions-duplicate-identifier-typescript-fix/

@meiordac

This comment has been minimized.

Copy link

meiordac commented Nov 10, 2016

Downgrading to "angular-in-memory-web-api": "0.1.13" worked fine

peterblazejewicz added a commit to peterblazejewicz/ng-material-templates that referenced this issue Nov 14, 2016

@ghost

This comment has been minimized.

Copy link

ghost commented Nov 17, 2016

Issue is in file:

node_modules/angular-in-memory-web-api/in-memory-backend.service.d.ts

Just remove:
/// <reference types="core-js" />

and all will work fine.

This is sooooo fragile solution so don't use in production !!!

Downgrading to 0.1.13 until this pretty critical bug is fixed.

@mmc41

This comment has been minimized.

Copy link

mmc41 commented Nov 18, 2016

@wardbell Could this bug be fixed please (removing the offending line at detailed above)?

@davinkevin

This comment has been minimized.

Copy link

davinkevin commented Nov 18, 2016

I've proposed a PR ( #65 ) to do that, but no one merge it... 😢

@smurphy917

This comment has been minimized.

Copy link

smurphy917 commented Nov 18, 2016

Yes, I have this issue also. Please merge #65. Thanks!

@jasonswett

This comment has been minimized.

Copy link

jasonswett commented Nov 20, 2016

FYI, if this is an urgent issue for anyone and you don't want to wait for #65 to get merged, you can just create your own fork of this repo, apply the fix yourself, and use your forked repo in your package.json until #65 (or some other fix) does get merged. That's what I did.

@wardbell

This comment has been minimized.

Copy link
Collaborator

wardbell commented Nov 21, 2016

I think we fixed in v.0.1.16

@wardbell wardbell closed this Nov 21, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment