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

erro no json server

Sempre que eu tento instalar o json server da esse erro

PS C:\Users\tadeu\OneDrive\Documentos\alura 2024\projeto-vidflow-main\backend> npm install -g json-server C:\Program Files\nodejs\node_modules\npm\lib\es6\validate-engines.js:31 throw err ^

Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\node_modules@npmcli\agent\node_modules\http-proxy-agent\dist\index.js'. Please verify that the package.json has a valid "main" entry at tryPackage (node:internal/modules/cjs/loader:444:19) at Module._findPath (node:internal/modules/cjs/loader:715:18) at Module._resolveFilename (node:internal/modules/cjs/loader:1130:27) at Module._load (node:internal/modules/cjs/loader:985:27) at Module.require (node:internal/modules/cjs/loader:1235:19) at require (node:internal/modules/helpers:176:18) at Object. (C:\Program Files\nodejs\node_modules\npm\node_modules@npmcli\agent\lib\proxy.js:3:28) at Module._compile (node:internal/modules/cjs/loader:1376:14) at Module._extensions..js (node:internal/modules/cjs/loader:1435:10) at Module.load (node:internal/modules/cjs/loader:1207:32) { code: 'MODULE_NOT_FOUND', path: 'C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\agent\node_modules\http-proxy-agent\package.json', requestPath: 'http-proxy-agent' }

Node.js v20.11.1 C:\Program Files\nodejs\node_modules\npm\lib\es6\validate-engines.js:31 throw err ^

Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\node_modules@npmcli\agent\node_modules\http-proxy-agent\dist\index.js'. Please verify that the package.json has a valid "main" entry at tryPackage (node:internal/modules/cjs/loader:444:19) at Module._findPath (node:internal/modules/cjs/loader:715:18) at Module._resolveFilename (node:internal/modules/cjs/loader:1130:27) at Module._load (node:internal/modules/cjs/loader:985:27) at Module.require (node:internal/modules/cjs/loader:1235:19) at require (node:internal/modules/helpers:176:18) at Object. (C:\Program Files\nodejs\node_modules\npm\node_modules@npmcli\agent\lib\proxy.js:3:28) at Module._compile (node:internal/modules/cjs/loader:1376:14) at Module._extensions..js (node:internal/modules/cjs/loader:1435:10) at Module.load (node:internal/modules/cjs/loader:1207:32) { code: 'MODULE_NOT_FOUND', path: 'C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\agent\node_modules\http-proxy-agent\package.json', requestPath: 'http-proxy-agent' }

Node.js v20.11.1

2 respostas

Ola!

desinstala e faça a reinstação do Nodejs, deve te ocorrido algum erro na instalação e aproveita pra instalar a versão mais nova:

https://nodejs.org/en/download/ faz download da versão LTS que é a mais recomendada

npm uninstall -g json-server
npm install -g json-server
solução!

infelizmente continua o erro desinstalei e instalei 2 vezes