Solucionado (ver solução)
Solucionado
(ver solução)
4
respostas

npm ERR! Code E404

Olá Professor Luiz Fernando e alunos

Estou começando o curso "Fundamentos do React" e seguindo passo-a-passo do professor, instalei o Git Bash e comecei a digitar os comandos e deu esse erro abaixo:

Flavio Alcantara@Alcantara MINGW64 ~ $ npm -v 8.3.0

Flavio Alcantara@Alcantara MINGW64 ~ $ npx creat-react-app

npm ERR! code E404 npm ERR! 404 Not Found - GET https://registry.npmjs.org/creat-react-app - Not found npm ERR! 404 npm ERR! 404 'creat-react-app@latest' is not in this registry. npm ERR! 404 You should bug the author to publish it (or use the name yourself!) npm ERR! 404 npm ERR! 404 Note that you can also install from a npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\Flavio Alcantara\AppData\Local\npm-cache_logs\2022-04-10T01_24_47_993Z-debug-0.log

Flavio Alcantara@Alcantara MINGW64 ~ $ npx creat-react-app --template typescript --use-npm alura-studies

npm ERR! code E404 npm ERR! 404 Not Found - GET https://registry.npmjs.org/creat-react-app - Not found npm ERR! 404 npm ERR! 404 'creat-react-app@latest' is not in this registry. npm ERR! 404 You should bug the author to publish it (or use the name yourself!) npm ERR! 404 npm ERR! 404 Note that you can also install from a npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\Flavio Alcantara\AppData\Local\npm-cache_logs\2022-04-10T01_25_37_738Z-debug-0.log

Flavio Alcantara@Alcantara MINGW64 ~ $

Onde estou errando? Será que está faltando algum componente?

Aguardo respostas. Att: Flávio Alcantara

4 respostas

Olá, Flávio! Tudo bom? Eu vi que você digitou npx creat-react-app mas o correto é npx create-react-app. Tente novamente e veja se isso resolve seu problema. Abraços!

Olá Neilton Obrigado por mostrar o meu erro de digitação. Mas quando fui digitar de forma correta, ainda continuava o mesmo problema até que, fiz dessa forma: npx create-react-app alura-studies --template typescript aí então começou a criar a pasta com a mensagem: Creating a new React app in c:\Users\Flavio Alcantara\alura-studies, e começou a instalar os packages e reats.

No final deu essa mensagem: added 1353 package in 1m 171 packages are looking for funding run npm fund for details

Initialized a git repository.

Installing template dependencies using npm... npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! While resolving: alura-studies@0.1.0 npm ERR! Found: react@18.0.0 npm ERR! node_modules/react npm ERR! react@"^18.0.0" from the root project npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer react@"<18.0.0" from @testing-library/react@12.1.5 npm ERR! node_modules/@testing-library/react npm ERR! @testing-library/react@"^12.0.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\Flavio Alcantara\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\Flavio Alcantara\AppData\Local\npm-cache_logs\2022-04-11T22_59_25_438Z-debug-0.log npm install --no-audit --save @testing-library/jest-dom@^5.14.1 @testing-library/react@^12.0.0 @testing-library/user-event@^13.2.1 @types/jest@^27.0.1 @types/node@^16.7.13 @types/react@^17.0.20 @types/react-dom@^17.0.9 typescript@^4.4.2 web-vitals@^2.1.0 failed

Depois entrei na pasta digitando: cd alura-studies e digitei npm start onde apareceu a mensagem: > alura-studies@0.1.0 start e > react-script start

Depois apareceu esse ERROR Monstruoso:

(node:4868) [DEP_WEBPACK_DEV_SERVER_ON_AFTER_SETUP_MIDDLEWARE] DeprecationWarning: 'onAfterSetupMiddleware' option is deprecated. Please use the 'setupMiddlewares' option. (Use node --trace-deprecation ... to show where the warning was created) (node:4868) [DEP_WEBPACK_DEV_SERVER_ON_BEFORE_SETUP_MIDDLEWARE] DeprecationWarning: 'onBeforeSetupMiddleware' option is deprecated. Please use the 'setupMiddlewares' option. Starting the development server...

Failed to compile.

Module not found: Error: Can't resolve './App' in 'C:\Users\Flavio Alcantara\alura-studies\src' asset static/js/bundle.js 1.58 MiB [emitted] (name: main) 1 related asset asset index.html 1.67 KiB [emitted] asset asset-manifest.json 190 bytes [emitted] runtime modules 28.5 KiB 14 modules modules by path ./node_modules/ 1.47 MiB 95 modules modules by path ./src/ 5.9 KiB ./src/index.tsx 1.8 KiB [built] [code generated] ./src/index.css 2.72 KiB [built] [code generated] ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[2]!./node_modules/source-map-loader/dist/cjs.js!./src/index.css 1.37 KiB [built] [code generated]

ERROR in ./src/index.tsx 7:0-24 Module not found: Error: Can't resolve './App' in 'C:\Users\Flavio Alcantara\alura-studies\src' resolve './App' in 'C:\Users\Flavio Alcantara\alura-studies\src' using description file: C:\Users\Flavio Alcantara\alura-studies\package.json (relative path: ./src) Field 'browser' doesn't contain a valid alias configuration using description file: C:\Users\Flavio Alcantara\alura-studies\package.json (relative path: ./src/App) no extension Field 'browser' doesn't contain a valid alias configuration C:\Users\Flavio Alcantara\alura-studies\src\App doesn't exist .web.mjs Field 'browser' doesn't contain a valid alias configuration C:\Users\Flavio Alcantara\alura-studies\src\App.web.mjs doesn't exist .mjs Field 'browser' doesn't contain a valid alias configuration C:\Users\Flavio Alcantara\alura-studies\src\App.mjs doesn't exist .web.js Field 'browser' doesn't contain a valid alias configuration C:\Users\Flavio Alcantara\alura-studies\src\App.web.js doesn't exist .js Field 'browser' doesn't contain a valid alias configuration C:\Users\Flavio Alcantara\alura-studies\src\App.js doesn't exist .json Field 'browser' doesn't contain a valid alias configuration C:\Users\Flavio Alcantara\alura-studies\src\App.json doesn't exist .web.jsx Field 'browser' doesn't contain a valid alias configuration C:\Users\Flavio Alcantara\alura-studies\src\App.web.jsx doesn't exist .jsx Field 'browser' doesn't contain a valid alias configuration C:\Users\Flavio Alcantara\alura-studies\src\App.jsx doesn't exist as directory C:\Users\Flavio Alcantara\alura-studies\src\App doesn't exist webpack 5.72.0 compiled with 2 errors in 15470 ms

No entanto, uma boa noticia, o browser do internet explorer abriu e com o título - localhost:3000. Acho que vai funcionar, senão, notifico novamente. Caso funcione, dou como encerrado essa sessão.

Flávio Alcantara - Aluno Alura.

solução!

Bom pessoal, não funcionou, está dando erro de conexão com servidor e problemas com Internet Explores Edge. Para ser sincero, tá dando um monte de erro. Mas vou continuar mesmo assim, paciência.

Problema encerrado.