tomastrajan / angular-ngrx-material-starter

Angular, NgRx, Angular CLI & Angular Material Starter Project
https://tomastrajan.github.io/angular-ngrx-material-starter
MIT License
2.83k stars 917 forks source link

Error running a new-project on the example component when uses the State #332

Closed gdmartinezsandino closed 5 years ago

gdmartinezsandino commented 6 years ago

Hey I initialized a new project I follow all steps of the installation but when I try running the repository I obtain this output:

ERROR in src/app/examples/examples/examples.component.ts(56,13): error TS2345: Argument of type '(source$: Observable<State>) => Observable<SettingsState>' is not assignable to parameter of type 'OperatorFunction<State, SettingsState>'. Types of parameters 'source$' and 'source' are incompatible. Type 'import("/home/gd.martinez/Downloads/Bakuq/Projects/Repos/new-project/node_modules/rxjs/internal/O...' is not assignable to type 'import("/home/gd.martinez/Downloads/Bakuq/Projects/Repos/new-project/node_modules/rxjs/internal/O...'. Two different types with this name exist, but they are unrelated. Type 'import("/home/gd.martinez/Downloads/Bakuq/Projects/Repos/new-project/src/app/examples/examples.st...'is not assignable to type 'import("/home/gd.martinez/Downloads/Bakuq/Projects/Repos/new-project/src/app/settings/settings.mo...'. Property 'settings' is missing in type 'State'.

Any ideas on how to fix this?

timdeschryver commented 6 years ago

Hi @gdmartinez93 could you share what you did? Because I can't reproduce it, I did:

$ git clone https://github.com/tomastrajan/angular-ngrx-material-starter.git
$ cd angular-ngrx-material-starter
$ npm install
$ npm run start
gdmartinezsandino commented 6 years ago

Hi @timdeschryver, I'm following exactly the same steps you mentioned. I would like to try the same in another machine. I let you know what's the result of that.

EDIT: My current Node and NPM version are:

tomastrajan commented 6 years ago

@gdmartinez93 you can also try npm ci instead of npm install.

gdmartinezsandino commented 6 years ago

@tomastrajan the command npm ci not work for me

This is a screenshot to the specific part where happen this error.

image

timdeschryver commented 6 years ago

I am able to reproduce it by clearing my node_modules and removing the package-lock.json. But if I do a clean install while having the package-lock.json file, it does compile.

My guess here is that your installation isn't looking to this package-lock.json file. Which version of npm and node do you have installed, you can check this with

$ node --version
$ npm --version
tomastrajan commented 6 years ago

@timdeschryver the versions are

Node: v9.6.1
NPM: 5.6.0

as written in one of the above comments and the 5.6.0 seems to support package-lock.json which is strange...

xinxiang commented 6 years ago

I started with node v8.10.0 and npm 3.5.2; got the same error @gdmartinez93 described.

Upgraded node to v8.12.0 and npm to 6.4.1; npm start still gave me the same error. Deleted node_modules, ran npm install again, and still got the same error. So I deleted the whole project and started all over again. This time it worked.

tomastrajan commented 6 years ago

@xinxiang this is interesting, deleting node_modules should be enough to refresh it, thank you for your feedback!

gdmartinezsandino commented 6 years ago

In my case is different I tried removing all the project and clone again to repeat the installation process and the result is the same error.

tomastrajan commented 6 years ago

@gdmartinez93 what kind of environment are you sing ? (eg windows cmd, cygwin, wsl, macOS, unix ) Sometimes there could be a miss match between what is available where. Sometimes I had different node / npm version on win compared to what I installed in WSL and that resulted in strange behavior. Anyway maybe this doesn't apply to you, I am just trying to rule out any possibilities.

gdmartinezsandino commented 6 years ago

@tomastrajan, I'm using the console inside Visual Studio Code I think that is the same console of the Unix System. I'm using too NVM for managing the versions of Node, I will try with other versions and let you know the result

stefanwuthrich commented 6 years ago

I had the same problem, but only when using yarn. changing to "rxjs": "6.2.2" resolved problem

xinxiang commented 6 years ago

The problem showed again while I was trying to add a module in it. But this time, npm start works and the pages work just fine. Only the error message showed on the terminal and npm test could not proceed. I don't know exactly which of my actions triggered this problem; however, by downgrading rxjs from 6.3.3 to 6.2.2 as @stefanwuthrich suggested, the error is gone and npm test works as well. Thanks.

Taewa commented 5 years ago

I had similar issue which logs error TS2345. Resolved by upgrade ngrx effects, store, router-store from 6.1.0 to 6.1.2

tomastrajan commented 5 years ago

This is outdated as project was migrated to Angular / NgRx 8. (old issue cleanup)