Error TS1005: ';' expected. TypeScript Angular 6 For First Build error rxjs inside node_modules

后端 未结 18 1962
北恋
北恋 2021-01-31 13:37

I\'m building my first Angular Application. I\'m creating a new Angular application using this command ng new purchase-section. But when I executing the application

相关标签:
18条回答
  • 2021-01-31 13:51

    Just remove ^ character from "rxjs": "^6.0.0" from package.json file and make it "rxjs": "6.0.0". It should work fine.

    0 讨论(0)
  • 2021-01-31 13:53

    Update in package.json rxjs": "6.3.3"

    in terminal 1. run npm update 2. run ng serve

    It should compile successfully

    0 讨论(0)
  • 2021-01-31 13:54

    Your package.json has following lines:

    "rxjs": "^6.0.0",
    
    "typescript": "~2.7.2"
    

    This tells npm to install the following versions

    rxjs: Latest version in version 6 series which is 6.4.0

    typescript: Latest patched version in minor version 2.7 which is 2.7.2

    Now RxJS module also installs the type definition files for TypeScript. The type definition file included in the rxjs module that got installed in your project is not compatible with typescript version installed in the same project.

    So as a solution in your package.json file you can either bump up the version of Typescript to say 2.8 as

    typescript: ^2.8.0

    or bump down the version of ngrx to something like

    ngrx: ~6.0.0 and

    do a fresh npm install.

    You can check the version number of the module installed by looking in following files:

    node_modules/rxjs/package.json and
    node_modules/typescript/package.json 
    
    0 讨论(0)
  • 2021-01-31 13:59

    Go to the project directory run: npm install rxjs@6.0.0 --save

    0 讨论(0)
  • 2021-01-31 13:59

    You can update your npm version to the latest, if it isn't, with:

    npm update -g
    
    0 讨论(0)
  • 2021-01-31 13:59

    Encountered this error with: rxjs/store: ^6.4.0 typescript: ~2.7.2 angular/cli ~6.0.0

    Updated everything to the latest except rxjs rxjs/store: ^6.3.3 typescript: ~3.1.1 angular/cli ~7.0.3

    Basically I created an blank new project (ng new newProject) and installed @ngrx/store which brought down v6.3.3. This worked for me.

    0 讨论(0)
提交回复
热议问题