AdvancedProductivity / Gable

An API platform for building and using APIs
Apache License 2.0
49 stars 5 forks source link

Cannot run the client #64

Open lurongjiang opened 2 years ago

lurongjiang commented 2 years ago

Why not unify the Angular versions? According to the documentation,then I try the command npm i ,it doesn't work.Command npm -i --force pass, but npm run start cannot run the client.

The command ouput follow below

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @angular/animations@13.3.1
npm ERR! Found: @angular/core@14.2.2
npm ERR! node_modules/@angular/core
npm ERR!   @angular/core@"14.2.2" from the root project
npm ERR!   peer @angular/core@"^13.0.0 || ^14.0.0-0" from @angular/cdk@13.3.9
npm ERR!   node_modules/@angular/cdk
npm ERR!     @angular/cdk@"13.3.9" from the root project
npm ERR!     peer @angular/cdk@"13.3.9" from @angular/material@13.3.9
npm ERR!     node_modules/@angular/material
npm ERR!       @angular/material@"13.3.9" from the root project
npm ERR!       1 more (@w3soto/ngx-mat-context-menu-trigger)
npm ERR!   8 more (@angular/elements, @angular/material, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/core@"13.3.1" from @angular/animations@13.3.1
npm ERR! node_modules/@angular/animations
npm ERR!   @angular/animations@"13.3.1" from the root project
npm ERR!   peer @angular/animations@"^13.0.0 || ^14.0.0-0" from @angular/material@13.3.9
npm ERR!   node_modules/@angular/material
npm ERR!     @angular/material@"13.3.9" from the root project
npm ERR!     1 more (@w3soto/ngx-mat-context-menu-trigger)
npm ERR!   1 more (@angular/platform-browser)
npm ERR!
npm ERR! Conflicting peer dependency: @angular/core@13.3.1
npm ERR! node_modules/@angular/core
npm ERR!   peer @angular/core@"13.3.1" from @angular/animations@13.3.1
npm ERR!   node_modules/@angular/animations
npm ERR!     @angular/animations@"13.3.1" from the root project
npm ERR!     peer @angular/animations@"^13.0.0 || ^14.0.0-0" from @angular/material@13.3.9
npm ERR!     node_modules/@angular/material
npm ERR!       @angular/material@"13.3.9" from the root project
npm ERR!       1 more (@w3soto/ngx-mat-context-menu-trigger)
npm ERR!     1 more (@angular/platform-browser)
ziqiangai commented 2 years ago

The project was start with the template angular-electron, but the version is ng13 now is ng14. So this template library solves all version dependency problems of Angular and Electron. Theoretically, the npm i command will not cause problems unless it is difficult to access Github. I guess why npm i doesn't work. It may be that it needs to download the relevant dependencies of the electron from github, but they are not successful because of the network.

Why not unify the Angular versions? According to the documentation,then I try the command npm i ,it doesn't work.Command npm -i --force pass, but npm run start cannot run the client.

The command ouput follow below

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @angular/animations@13.3.1
npm ERR! Found: @angular/core@14.2.2
npm ERR! node_modules/@angular/core
npm ERR!   @angular/core@"14.2.2" from the root project
npm ERR!   peer @angular/core@"^13.0.0 || ^14.0.0-0" from @angular/cdk@13.3.9
npm ERR!   node_modules/@angular/cdk
npm ERR!     @angular/cdk@"13.3.9" from the root project
npm ERR!     peer @angular/cdk@"13.3.9" from @angular/material@13.3.9
npm ERR!     node_modules/@angular/material
npm ERR!       @angular/material@"13.3.9" from the root project
npm ERR!       1 more (@w3soto/ngx-mat-context-menu-trigger)
npm ERR!   8 more (@angular/elements, @angular/material, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/core@"13.3.1" from @angular/animations@13.3.1
npm ERR! node_modules/@angular/animations
npm ERR!   @angular/animations@"13.3.1" from the root project
npm ERR!   peer @angular/animations@"^13.0.0 || ^14.0.0-0" from @angular/material@13.3.9
npm ERR!   node_modules/@angular/material
npm ERR!     @angular/material@"13.3.9" from the root project
npm ERR!     1 more (@w3soto/ngx-mat-context-menu-trigger)
npm ERR!   1 more (@angular/platform-browser)
npm ERR!
npm ERR! Conflicting peer dependency: @angular/core@13.3.1
npm ERR! node_modules/@angular/core
npm ERR!   peer @angular/core@"13.3.1" from @angular/animations@13.3.1
npm ERR!   node_modules/@angular/animations
npm ERR!     @angular/animations@"13.3.1" from the root project
npm ERR!     peer @angular/animations@"^13.0.0 || ^14.0.0-0" from @angular/material@13.3.9
npm ERR!     node_modules/@angular/material
npm ERR!       @angular/material@"13.3.9" from the root project
npm ERR!       1 more (@w3soto/ngx-mat-context-menu-trigger)
npm ERR!     1 more (@angular/platform-browser)
ziqiangai commented 2 years ago

Can you provide the error report of the npm i command? Do not try to upgrade the Angular version to 14. I noticed that the Angular version installed on your computer is 14 But the version of this project is 13.

lurongjiang commented 2 years ago

Can you provide the error report of the npm i command? Do not try to upgrade the Angular version to 14. I noticed that the Angular version installed on your computer is 14 But the version of this project is 13.

Does it means I need to install Angular 13? I will try later.

ziqiangai commented 2 years ago

no no no. Angular 14 is the global version for cli command when create project. But in the specific project, It will follow the version number defined in package.json , and all lib will download in node_modules directory.

lurongjiang commented 2 years ago

I doesn't work. I has installed ng 13. bash Steps and output follow below:


npm install --location=global @angular/cli@13.3.1

ng version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/

Angular CLI: 13.3.1
Node: 16.15.1
Package Manager: npm 8.11.0
OS: win32 x64

Angular: 14.2.2 (cli-only)
... core

Package                             Version
-------------------------------------------------------------
@angular-devkit/architect           0.1303.1 (cli-only)
@angular-devkit/build-angular       <error>
@angular-devkit/core                13.3.1 (cli-only)
@angular-devkit/schematics          13.3.1 (cli-only)
@angular/animations                 <error>
@angular/cdk                        <error>
@angular/cli                        13.3.1 (cli-only)
@angular/common                     <error>
@angular/compiler                   <error>
@angular/compiler-cli               <error>
@angular/elements                   <error>
@angular/forms                      <error>
@angular/language-service           <error>
@angular/material                   <error>
@angular/platform-browser           <error>
@angular/platform-browser-dynamic   <error>
@angular/router                     <error>
@schematics/angular                 13.3.1 (cli-only)
rxjs                                6.6.7 (cli-only)
typescript                          <error>

But when I run the script npm i,The same error occurs:

npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @angular/animations@13.3.1
npm ERR! Found: @angular/core@14.2.2
npm ERR! node_modules/@angular/core
npm ERR!   @angular/core@"14.2.2" from the root project
npm ERR!   peer @angular/core@"^13.0.0 || ^14.0.0-0" from @angular/cdk@13.3.9
npm ERR!   node_modules/@angular/cdk
npm ERR!     @angular/cdk@"13.3.9" from the root project
npm ERR!     peer @angular/cdk@"13.3.9" from @angular/material@13.3.9
npm ERR!     node_modules/@angular/material
npm ERR!       @angular/material@"13.3.9" from the root project
npm ERR!       1 more (@w3soto/ngx-mat-context-menu-trigger)
npm ERR!   8 more (@angular/elements, @angular/material, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/core@"13.3.1" from @angular/animations@13.3.1
npm ERR! node_modules/@angular/animations
npm ERR!   @angular/animations@"13.3.1" from the root project
npm ERR!   peer @angular/animations@"^13.0.0 || ^14.0.0-0" from @angular/material@13.3.9
npm ERR!   node_modules/@angular/material
npm ERR!     @angular/material@"13.3.9" from the root project
npm ERR!     1 more (@w3soto/ngx-mat-context-menu-trigger)
npm ERR!   1 more (@angular/platform-browser)
npm ERR!
npm ERR! Conflicting peer dependency: @angular/core@13.3.1
npm ERR! node_modules/@angular/core
npm ERR!   peer @angular/core@"13.3.1" from @angular/animations@13.3.1
npm ERR!   node_modules/@angular/animations
npm ERR!     @angular/animations@"13.3.1" from the root project
npm ERR!     peer @angular/animations@"^13.0.0 || ^14.0.0-0" from @angular/material@13.3.9
npm ERR!     node_modules/@angular/material
npm ERR!       @angular/material@"13.3.9" from the root project
npm ERR!       1 more (@w3soto/ngx-mat-context-menu-trigger)
npm ERR!     1 more (@angular/platform-browser)

As you mentioned, Angular versions are defined in package.json.

    "@angular/animations": "13.3.1",
    "@angular/cdk": "13.3.9",
    "@angular/common": "13.3.1",
    "@angular/compiler": "13.3.1",
    "@angular/core": "14.2.2",
    "@angular/elements": "^14.1.1",
    "@angular/forms": "13.3.1",
    "@angular/language-service": "13.3.1",
    "@angular/material": "13.3.9",
    "@angular/platform-browser": "13.3.1",

Why not unify the angular version to 13.3.1.

It seems to have nothing to do with the network. Network is fine.

After I change the angular-core version to 13.3.1,everything is ok and I can run the client.

    "@angular/animations": "13.3.1",
    "@angular/cdk": "13.3.9",
    "@angular/common": "13.3.1",
    "@angular/compiler": "13.3.1",
    "@angular/core": "13.3.1",
    "@angular/elements": "^14.1.1",
    "@angular/forms": "13.3.1",
ziqiangai commented 2 years ago

my node js env is:

Angular CLI: 13.3.1
Node: 14.15.1
Package Manager: npm 6.14.8
OS: win32 x64

When I upgrade the nodejs version to 16 and npm version to 8, I will repeat your error stack.

I learn the principle. The command npm i will parse the dependency tree in package.json and written the parser result to file package-lock.json. The reason for this error is in the process of parsing the dependency tree.

The parsing process may be different in different nodejs environments.

I noticed that if the file package-lock.json is provided in the project directory, the npm i command will skip the parsing process and download the dependent libraries directly.

I have push the two package-lock.json file. you can run the git pull command and try.

Maybe solve the problem.