PillowPillow/ng2-webstorage

ERROR in : Can't resolve all parameters for LocalStorageService in node_modules/ngx-webstorage/ngx-webstorage.d.ts: (?)

Closed this issue · 4 comments

NgxWebstorage: 3.0.2
Angular: 7.2.4

Upgrading to angular 7.2.4 from 6.1.0. Renamed NgxWebstorage to NgxWebstorageModule. Started an AOT build and got this message.

ERROR in : Can't resolve all parameters for LocalStorageService in node_modules/ngx-webstorage/ngx-webstorage.d.ts: (?)

To Reproduce
Steps to reproduce the behavior:

  1. npm install
  2. node_modules/webpack/bin/webpack.js
  3. Scroll down to '....'
  4. See error
    ERROR in : Can't resolve all parameters for LocalStorageService in node_modules/ngx-webstorage/ngx-webstorage.d.ts: (?)

Expected behavior
Module resolves and build completes.

Desktop (please complete the following information):

  • OS: macOS 10.14.4
  • Node: v8.9.1
  • npm: 6.4.1

Additional context
Build completes in JIT mode but fails on loading in the browser with the same error.

Hello, can you share me your AppModule delaration. Didn't you forget to call the .forRoot() method?

app.module.ts

import { NgxWebstorageModule } from 'ngx-webstorage';

@NgModule({
    imports: [
        BrowserModule,
        BrowserAnimationsModule,
        SharedModule.forRoot(),
        CookieModule.forRoot(),
        NgxWebstorageModule.forRoot({ prefix: 'app', separator: ':'}),

shared.module.ts

import { NgxWebstorageModule } from 'ngx-webstorage';

@NgModule({
    imports: [
        CommonModule,
        HttpClientModule,
        RouterModule,
        CookieModule,
        NgxWebstorageModule,

Sorry for the late reply. Your configuration seems ok, (you don't have to import/export the NgxWebstorageModule in your shared.module but anyway).

Are you using the library in a APP_INITIALIZER factory ?

Please try to npm install from scratch your env.

I was able to figure it out. After removing the calls to the LocalStorageService from my project and then slowly add them back in. I found a component file that was using a call for providers with LocalStorageService.

@Component({
    providers: [LocalStorageService, BlogService],

This project references LocalStorageService over 300 times and it an old component in the project., along with webpack not explaining where it was failing caused great frustration.

Thanks for replaying and looking into this. I hope this post might help someone upgrade their project and not have issues like this either.