stevermeister / ngx-cookie-service

Angular (4.2+ ...12) service for cookies. Originally based on the `ng2-cookies` library.
https://www.npmjs.com/package/ngx-cookie-service
MIT License
546 stars 90 forks source link

Issue: 12.0.2 #144

Closed sagarwadekar2011 closed 3 years ago

sagarwadekar2011 commented 3 years ago

Getting the error while building the project

Error: node_modules/ngx-cookie-service/lib/cookie.service.d.ts:91:21 - error TS2694: Namespace '"node_modules/@angular/core/core"' has no exported member 'ɵɵFactoryDeclaration'.

The issue is in 12.0.2 version

Steps to Reproduce the Problem

npm install and build your project

robbiemu commented 3 years ago

same:

...

ERROR in node_modules/ngx-cookie-service/lib/cookie.service.d.ts:91:21 - error TS2694: Namespace '"/Users/robcollins/source/repos/EU-Web-Accounts/node_modules/@angular/core/core"' has no exported member 'ɵɵFactoryDeclaration'.
91     static ɵfac: i0.ɵɵFactoryDeclaration<CookieService, never>;
                       ~~~~~~~~~~~~~~~~~~~~
node_modules/ngx-cookie-service/lib/cookie.service.d.ts:92:22 - error TS2694: Namespace '"/Users/robcollins/source/repos/EU-Web-Accounts/node_modules/@angular/core/core"' has no exported member 'ɵɵInjectableDeclaration'.
92     static ɵprov: i0.ɵɵInjectableDeclaration<CookieService>;
                        ~~~~~~~~~~~~~~~~~~~~~~~
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! accounts@10.0.1 build:prod: `ng build --configuration=production`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the accounts@10.0.1 build:prod script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/robcollins/.npm/_logs/2021-08-04T17_45_08_053Z-debug.log
$ 

in my case, this is from ng build --configuration=production in a 10.2.4 angular environment

those broken links are to @angular/core/core (reverting to 12.0.0 resovles the issue)

pavankjadda commented 3 years ago

@sagarwadekar2011 @robbiemu Would you mind sharing sample StackBlitz repo that demonstrates the issue?

robbiemu commented 3 years ago

hey, I think, if it is not an obvious issue, it may be because we both have an infrequently updates library and a frequently updated app.

My organization creates npm packages for sharing common code. In one of them, we have a dependency on ngx-cookie-service@~2.4.0 The frequently updated app where I saw this behavior has a dependency on that package, but itself also imports ngx-cookie-service@^12.0.0 (those are developed by two different teams, thus the disconnect)

pavankjadda commented 3 years ago

hey, I think, if it is not an obvious issue, it may be because we both have an infrequently updates library and a frequently updated app.

My organization creates npm packages for sharing common code. In one of them, we have a dependency on ngx-cookie-service@~2.4.0 The frequently updated app where I saw this behavior has a dependency on that package, but itself also imports ngx-cookie-service@^12.0.0 (those are developed by two different teams, thus the disconnect)

In that case I would recommend to do clean install.

  1. Delete package-lock.json
  2. Delete node_modules folder
  3. Install dependencies again
robbiemu commented 3 years ago

If you were referring to the frequently changing repo, we did do this. It keeps happening. we first noticed it on the CI CD , But then deleting node modules and doing an npm i (instead of ci , which would conform to package-lock instead of overwriting it), I was able to reproduce the issue locally.

pavankjadda commented 3 years ago

If you were referring to the frequently changing repo, we did do this. It keeps happening. we first noticed it on the CI CD , But then deleting node modules and doing an npm i (instead of ci , which would conform to package-lock instead of overwriting it), I was able to reproduce the issue locally.

When using CI, it's always recommended to use package-lock.json and npm ci. The npm ci command performs clean install, see https://docs.npmjs.com/cli/v7/commands/npm-ci for details.

Using npm install may lead to inconsistencies especially in your case if you are using different versions

pavankjadda commented 3 years ago

@robbiemu if you still have an issue, chat with me on official discord channel of this library https://discord.com/channels/873021904708059177/873021905463029852

robbiemu commented 3 years ago

can you send me an invite privately? It says "you dont ahve access to this link. This link is to a server or channel you dont have access to"

Fully agree about the ci vs i thing. I've been espousing that for years. But, ... its a big company

pavankjadda commented 3 years ago

@robbiemu Here you go https://discord.gg/N3xc4Jfb

pavankjadda commented 3 years ago

@robbiemu Version 12.0.0 of the library needs Angular version 12. If you are using older version please make sure to use corresponding version.

pavankjadda commented 3 years ago

@robbiemu version 12.0.3 should fix the issue. Please try and let me know