6
respostas

Erro no comando npx create-react-app

Quando eu executo o comando npx create-react-app ceep aparece a seguinte mensagem:

You are running create-react-app 4.0.0, which is behind the latest release (4.0.1).

We no longer support global installation of Create React App.

Please remove any global installs with one of the following commands:

  • npm uninstall -g create-react-app
  • yarn global remove create-react-app

The latest instructions for creating a new app can be found here: https://create-react-app.dev/docs/getting-started/

Já tentei fazer o comando: - npm uninstall -g create-react-app e

  • yarn global remove create-react-app e não resolve o problema!

Já tenho instalado o node e o npm nas versões recomendadas pelo curso!

6 respostas

Como não consegui criar o projeto como no curso com o npx create-react-app, eu fiz o comando sem o npx, assim: $ create-react-app ceep

Não entendo por que no meu não funciona usar o npx ou npm antes do create-react-app.

Creating a new React app in C:\Users\Admin\Documents\Alura\3-Lidar com class components\bibliot-react\ceep.

warning ..........\package.json: No license field Installing packages. This might take a couple of minutes.Installing react, react-dom, and react-scripts with cra-template...

yarn add v1.22.4 warning ..........\package.json: No license field [1/4] Resolving packages... [2/4] Fetching packages... info fsevents@1.2.13: The platform "win32" is incompatible with this module. info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.info fsevents@2.2.1: The platform "win32" is incompatible with this module. info "fsevents@2.2.1" is an optional dependency and failed compatibility check. Excluding it from installation.info fsevents@2.1.3: The platform "win32" is incompatible with this module. info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.info fsevents@2.3.1: The platform "win32" is incompatible with this module. info "fsevents@2.3.1" is an optional dependency and failed compatibility check. Excluding it from installation.[3/4] Linking dependencies... warning "react-scripts > @typescript-eslint/eslint-plugin > tsutils@3.17.1" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta". [4/4] Building fresh packages... success Saved lockfile. warning Your current version of Yarn is out of date. The latest version is "1.22.5", while you're on "1.22.4".success Saved 6 new dependencies. info Direct dependencies ├─ cra-template@1.1.1 ├─ react-dom@17.0.1 ├─ react-scripts@4.0.1 └─ react@17.0.1 info All dependencies ├─ cra-template@1.1.1 ├─ react-dev-utils@11.0.1 ├─ react-dom@17.0.1 ├─ react-scripts@4.0.1 ├─ react@17.0.1 └─ scheduler@0.20.1 Done in 677.32s.

Initialized a git repository.

Installing template dependencies using yarnpkg...yarn add v1.22.4 warning ..........\package.json: No license field [1/4] Resolving packages... [2/4] Fetching packages... info fsevents@2.3.1: The platform "win32" is incompatible with this module. info "fsevents@2.3.1" is an optional dependency and failed compatibility check. Excluding it from installation.info fsevents@1.2.13: The platform "win32" is incompatible with this module. info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.info fsevents@2.2.1: The platform "win32" is incompatible with this module. info "fsevents@2.2.1" is an optional dependency and failed compatibility check. Excluding it from installation.info fsevents@2.1.3: The platform "win32" is incompatible with this module. info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.[3/4] Linking dependencies... warning "react-scripts > @typescript-eslint/eslint-plugin > tsutils@3.17.1" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta". warning " > @testing-library/user-event@12.6.0" has unmet peer dependency "@testing-library/dom@>=7.21.4".[4/4] Building fresh packages... success Saved lockfile. success Saved 17 new dependencies. info Direct dependencies ├─ @testing-library/jest-dom@5.11.8 ├─ @testing-library/react@11.2.3 ├─ @testing-library/user-event@12.6.0 ├─ react-dom@17.0.1 ├─ react@17.0.1 └─ web-vitals@0.2.4 info All dependencies ├─ @testing-library/dom@7.29.4 ├─ @testing-library/jest-dom@5.11.8 ├─ @testing-library/react@11.2.3 ├─ @testing-library/user-event@12.6.0 ├─ @types/aria-query@4.2.1 ├─ @types/jest@26.0.20 ├─ @types/testing-library__jest-dom@5.9.5 ├─ css.escape@1.5.1 ├─ css@3.0.0 ├─ dom-accessibility-api@0.5.4 ├─ lz-string@1.4.4 ├─ min-indent@1.0.1 ├─ react-dom@17.0.1 ├─ react@17.0.1 ├─ redent@3.0.0 ├─ strip-indent@3.0.0 └─ web-vitals@0.2.4 Done in 35.71s. Removing template package using yarnpkg...

Fala ai Maria, tudo bem? Parece que você tem o create-react-app instalado de forma global na sua máquina, ele não suporte mais esse funcionamento.

Tente remover a instalação global da máquina:

npm un -g create-react-app

E depois tente rodar o comando via npx novamente:

npx create-react-app ceep

Espero ter ajudado.

A primeira coisa que tentei fazer foi esse comando npm un -g create-react-app e depois npx create-react-app ceep e continuou dando o mesmo erro. Aí usei os comandos: npm cache clean --force

npm cache verify

Depois exclui o node do meu computador e reiniciei. Além disso tentei baixar o node na versão que usa no curso por nvm-windows no meu também não funcionou. Aí fiz o download pelo site mesmo. O que não entendo é porque toda vez que vou criar projeto novo fica dando esse mesmo erro no meu computador.

Fala Maria, estranho, acabei de rodar o comando por aqui e funcionou certinho.

Roda esse comando na sua máquina:

npm list -g --depth 0

Ele vai listar todas as dependencias instaladas de forma global na sua máquina.

Espero ter ajudado.

Eu rodei esse comando $ npm list -g --depth 0 e apareceu o seguinte:

C:\Users\Admin\AppData\Roaming\npm +-- gulp-cli@2.3.0 +-- http-server@0.12.3 +-- npm@6.14.11 +-- serve@11.3.2 `-- yarn@1.22.10

Fala Maria, estranho, realmente não tem a create-react-app instalada de forma global na máquina.

Roda o comando npx create-react-app teste e me manda o log completo dele, assim eu dou uma analisada completa.

Espero ter ajudado.