po-angular icon indicating copy to clipboard operation
po-angular copied to clipboard

ng add @po-ui/ng-components - Erro ao adicionar a biblioteca ao projeto

Open Lucas-Lombello opened this issue 1 year ago • 7 comments

Bom dia.

Estou com problemas também, para adicionar a biblioteca po-ui ao projeto. Está gerando o erro abaixo ao executar o comando: ng add @po-ui/ng-components

PS C:\Angular\my-po-project> ng add @po-ui/ng-components ? Would you like to share pseudonymous usage data about this project with the Angular Team at Google under Google's Privacy Policy at https://policies.google.com/privacy. For more details and how to change this setting, see https://angular.io/analytics. No Global setting: enabled Local setting: disabled Effective status: disabled ℹ Using package manager: npm ⚠ Unable to find compatible package. Using 'latest' tag. ⚠ Package has unmet peer dependencies. Adding the package may not succeed.

The package @po-ui/[email protected] will be installed and executed. Would you like to proceed? Yes npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! While resolving: [email protected] npm ERR! Found: [email protected] npm ERR! node_modules/rxjs npm ERR! rxjs@"~7.8.0" from the root project npm ERR! peer rxjs@"^6.5.3 || ^7.4.0" from @angular/[email protected] npm ERR! node_modules/@angular/core npm ERR! @angular/core@"^15.2.0" from the root project npm ERR! peer @angular/core@"^15.0.3" from @po-ui/[email protected] npm ERR! node_modules/@po-ui/ng-components npm ERR! @po-ui/ng-components@"15.7.0" from the root project npm ERR! 7 more (@angular/animations, @angular/common, ...) npm ERR! 3 more (@angular/common, @angular/forms, @angular/router) npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer rxjs@"~7.5.5" from @po-ui/[email protected] npm ERR! node_modules/@po-ui/ng-components npm ERR! @po-ui/ng-components@"15.7.0" from the root project npm ERR! npm ERR! Fix the upstream dependency conflict, or retry npm ERR! this command with --force, or --legacy-peer-deps npm ERR! to accept an incorrect (and potentially broken) dependency resolution. npm ERR! npm ERR! See C:\Users\lucas.lombello\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\xxx\AppData\Local\npm-cache_logs\2023-04-27T13_57_17_964Z-debug-0.log ✖ Packages installation failed, see above.

Estou utilizando as seguintes versões:

Angular CLI: 15.2.7 Node: 18.12.1 Package Manager: npm 8.19.2 OS: win32 x64

Angular: 15.2.8 ... animations, common, compiler, compiler-cli, core, forms ... platform-browser, platform-browser-dynamic, router

Package Version @angular-devkit/architect 0.1502.7 @angular-devkit/build-angular 15.2.7 @angular-devkit/core 15.2.7 @angular-devkit/schematics 15.2.7 @angular/cli 15.2.7 @schematics/angular 15.2.7 rxjs 7.8.1 typescript 4.9.5

Lucas-Lombello avatar Apr 27 '23 14:04 Lucas-Lombello

Boa Tarde @Lucas-Lombello, tudo bem?

A versão do rxjs que usamos e a 7.5.5, este problema ocorre por conta de compatibilidade, seria interessante verificar a compatibilidade com as outras, isso ocorre porque esta pegando uma versão do nodejs, angular cli e poui diferentes!

Attr.

anliben avatar Apr 27 '23 20:04 anliben

Tive o mesmo problema, removi o rxjs e instalei na versão 7.5.5 para correção.

cirqueira-labs avatar May 31 '23 01:05 cirqueira-labs

Segue a documentação: https://po-ui.io/guides/getting-started

Há muitos fatores que contribuem pro erro de instalação, eu segui os passos da doc, porém eu estava usando a instalação miníma do angular: ng new myapp --minimal, fiz conforme o que fora pedido na documentação e funcionou.

EricNeves avatar Nov 16 '23 21:11 EricNeves

Tive o mesmo erro

The package @po-ui/[email protected] will be installed and executed. Would you like to proceed? Yes npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! While resolving: [email protected] npm ERR! Found: [email protected] npm ERR! node_modules/rxjs npm ERR! rxjs@"~7.8.0" from the root project npm ERR! peer rxjs@"^6.5.3 || ^7.4.0" from @angular/[email protected]

A solução foi: 1- apagar a pasta node_modules 2- Apagar o package-lock.json 3- Editar o rxjs no package.json para "rxjs": "~7.5.0" 4- Dar um npm install 5- ng add @po-ui/ng-components

ℹ Using package manager: npm ✔ Found compatible package version: @po-ui/[email protected]. ✔ Package information loaded.

The package @po-ui/[email protected] will be installed and executed. Would you like to proceed? Yes ✔ Packages successfully installed. ? Would you like to configure Sidemenu? Yes UPDATE package.json (1090 bytes) UPDATE src/app/app.module.ts (613 bytes) UPDATE angular.json (2907 bytes) UPDATE src/app/app.component.html (205 bytes) UPDATE src/app/app.component.spec.ts (757 bytes) UPDATE src/app/app.component.ts (405 bytes) UPDATE src/app/app.component.css (0 bytes) ✔ Packages installed successfully.

quaresma-cq avatar Feb 29 '24 20:02 quaresma-cq

Boa Noite!

Também estou instalando e experimentando o POUI.

E percebi que a maior dificuldade é tratar as dependências. Seguindo a documentação em: https://po-ui.io/guides/getting-started dará certo!

O ponto de atenção é com relação a versão e o símbolo ^ ou ~ antes da versão.

Isso pode passar um pouco despercebido para quem está iniciando com o Node.js. No meu caso ao ajustar a versão como no site do POUi e colocar corretamente "~" onde solicitado evitou problemas de dependências.

No meu caso as dependências e versões que funcionaram foram:

  • Node 20.11.1 (node -v)
  • NPM 10.2.4 (npm version)
  • Angular Cli 17.0.10 (ng version dentro do projeto)

Nota: Seria interessante se no site de instalação, mencionasse maior ou igual versão X de todos esses componentes, visto que suas versões podem gerar incompatibilidades e apresentar formas de fazer downgrade se necessário.

"dependencies": { "@angular/animations": "~17.0.4", "@angular/common": "~17.0.4", "@angular/compiler": "~17.0.4", "@angular/core": "~17.0.4", "@angular/forms": "~17.0.4", "@angular/platform-browser": "~17.0.4", "@angular/platform-browser-dynamic": "~17.0.4", "@angular/router": "~17.0.4", "@po-ui/ng-components": "^17.0.0", "rxjs": "~7.8.1", "tslib": "^2.6.2", "zone.js": "~0.14.2" }, "devDependencies": { "@angular-devkit/build-angular": "~17.0.3", "@angular/cli": "~17.0.3", "@angular/compiler-cli": "~17.0.4", "@types/jasmine": "~5.1.0", "jasmine-core": "~5.1.0", "karma": "~6.4.0", "karma-chrome-launcher": "~3.2.0", "karma-coverage": "~2.2.0", "karma-jasmine": "~5.1.0", "karma-jasmine-html-reporter": "~2.1.0", "typescript": "~5.2.2" }

Entretanto, após executar: npm install

Obtive mensagens de vulnerabilidades que não encontrei mais informações no site do POUi de como resolver. Seria bom ter uma orientação sobre isso!

Exemplo:

  • Devemos executar npm audit fix como é solicitado no warning?
  • Isso pode prejudicar a execução dos apps em PO Ui?
  • O que provocou essas vulnetabilidades?

Mensagens Retornadas: **npm WARN deprecated [email protected]: Use your platform's native atob() and btoa() methods instead

added 992 packages, and audited 993 packages in 25s

120 packages are looking for funding run npm fund for details

6 vulnerabilities (1 low, 3 moderate, 2 high)

To address issues that do not require attention, run: npm audit fix

To address all issues, run: npm audit fix --force**

carloseniemeyer avatar Mar 06 '24 01:03 carloseniemeyer

Sobre os warnings, no meu caso, executei o comando e aparentemente foi resolvido o problema.

npm audit fix --force

npm WARN using --force Recommended protections disabled. npm WARN audit Updating @angular-devkit/build-angular to 17.2.2, which is outside your stated dependency range.

added 23 packages, removed 84 packages, changed 41 packages, and audited 936 packages in 13s

122 packages are looking for funding run npm fund for details

found 0 vulnerabilities

carloseniemeyer avatar Mar 06 '24 01:03 carloseniemeyer

Boa Noite @carloseniemeyer, obrigado pela sua colaboração!

anliben avatar Mar 12 '24 21:03 anliben