5
respostas

Npx não executa

Quando o rodo o comando npx create-react-app tenho esse erro como retorno :

Arguments: 
  C:\Program Files\nodejs\node.exe C:\Program Files (x86)\Yarn\bin\yarn.js add --exact react react-dom react-scripts cra-template --cwd C:\Users\usuario\Desktop\alura\ceep

Yarn version: 
  1.22.4

Node version: 
  12.16.1

Platform: 
  win32 x64

Trace: 
  Error: https://registry.yarnpkg.com/react: tunneling socket could not be established, cause=getaddrinfo ENOTFOUND http
      at ClientRequest.onError (C:\Program Files (x86)\Yarn\lib\cli.js:152234:17)
      at Object.onceWrapper (events.js:418:26)
      at ClientRequest.emit (events.js:311:20)
      at Socket.socketErrorListener (_http_client.js:426:9)
      at Socket.emit (events.js:311:20)
      at emitErrorNT (internal/streams/destroy.js:92:8)
      at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
      at processTicksAndRejections (internal/process/task_queues.js:84:21)
5 respostas

Fala ai Breno, tudo bem? Consegue postar o comando completo que você executou no termina e o log completo após executar o comando?

Se possível, compartilha a versão do Windows também.

Espero ter ajudado.

Windows 10

NPX rodei, mas diferente do video não veio com a pasta node_modules, e quando rodei o npm install aconteceu isso :

npm install
npm WARN registry Using stale data from https://registry.npmjs.org/ because the host is inaccessible -- are you offline?npm WARN registry Using stale data from https://registry.npmjs.org/ due to a request error during revalidation.
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated @types/testing-library__dom@7.5.0: This is a stub types definition. testing-library__dom provides its own type definitions, so you do not need this installed.
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated left-pad@1.3.0: use String.prototype.padStart()
npm WARN deprecated core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules\react-scripts\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! network request to https://registry.npmjs.org/debug/-/debug-4.2.0.tgz failed, reason: getaddrinfo ENOTFOUND http
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\usuarioTeste\AppData\Roaming\npm-cache\_logs\2020-09-23T13_03_36_100Z-debug.log

Fala Breno, a pasta node_modules não é versionada, a gente gera ela quando o npm i ou npm ci.

Acredito que possa ser problema com proxy, você está rodando em algum PC no trampo? Sua internet tem algum proxy ou algo do tipo?

Espero ter ajudado.

E ai Matheus, cara é isso mesmo, estou usando o PC aqui da empresa pra fazer alguns testes e tem proxy sim...

Rodei até com o comando npm config set http-proxy mas sem sucesso também..

Fala Breno, dá uma olhada nesse dúvida: https://cursos.alura.com.br/forum/topico-configuracao-de-proxy-no-node-js-28587

E talvez esse outro link: https://gist.github.com/erkobridee/4061363

Acho que faltou tu setar o registro do npm.

Espero ter ajudado.