Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

[Projeto] Erros no pós criação do single-spa hello-world

Com node 22, stable atual, criar o hello-world via npx create-single-spa terminou com o seguinte, diferente do resultado da aula (que estou seguindo sem problemas até aqui em Ubuntu 22 – e vale frisar que com o orquestrador correu tudo certo):

I'm all done. Running npm install for you to install the required dependencies. If this fails, try running the command yourself.


npm warn config cache-min This option has been deprecated in favor of `--prefer-offline`.
npm error code ERESOLVE
npm error ERESOLVE could not resolve
npm error
npm error While resolving: @testing-library/react@16.3.0
npm error Found: @types/react@17.0.87
npm error node_modules/@types/react
npm error   @types/react@"^17.0.19" from the root project
npm error   peer @types/react@"^17.0.0" from @types/react-dom@17.0.26
npm error   node_modules/@types/react-dom
npm error     @types/react-dom@"^17.0.9" from the root project
npm error     peerOptional @types/react-dom@"*" from single-spa-react@6.0.2
npm error     node_modules/single-spa-react
npm error       single-spa-react@"^6.0.2" from the root project
npm error   1 more (single-spa-react)
npm error
npm error Could not resolve dependency:
npm error peerOptional @types/react@"^18.0.0 || ^19.0.0" from @testing-library/react@16.3.0
npm error node_modules/@testing-library/react
npm error   dev @testing-library/react@"^16.0.1" from the root project
npm error
npm error Conflicting peer dependency: @types/react@19.1.10
npm error node_modules/@types/react
npm error   peerOptional @types/react@"^18.0.0 || ^19.0.0" from @testing-library/react@16.3.0
npm error   node_modules/@testing-library/react
npm error     dev @testing-library/react@"^16.0.1" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.
npm error
npm error
npm error For a full report see:
npm error /home/s088255877/.npm/_logs/2025-08-20T20_43_36_688Z-eresolve-report.txt
npm error A complete log of this run can be found in: /home/s088255877/.npm/_logs/2025-08-20T20_43_36_688Z-debug-0.log
Project setup complete!
Steps to test your React single-spa application:
1. Run 'npm start -- --port 8500'
2. Go to http://single-spa-playground.org/playground/instant-test?name=@home-hub/hello-world&url=8500 to see it working!

Ainda, tentar rodar npm start -- --port 8500 dá falta do webpack:

> start
> webpack serve --port 8500

sh: 1: webpack: not found

Vejo no create-single-spa que é dependência desencontrada da @testing-library/react com @types/react. Mas falta algo da minha parte ou a stack está com algum erro? Como resolver?

Agradeço.

1 resposta
solução!

Depois de gastar um bom tempo de Google, a "solução" foi rodar, na raiz do diretório home-hub/hello-world/ criado pela ferramenta: npm install --legacy-peer-deps

Porém, npm start -- --port 8500 ainda reclamava da ausência de webpack, para o que rodei npm install -D webpack no diretório pai (home-hub/) e o start passou a funcionar.