Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

274
Visualizações
Seeing error Module not found: 'pg-native' in heroku app

I'm attempting to use the postgres add-on with a heroku node app that is also using react.

I'm using this react buildpack to support react inside heroku: https://github.com/opike/create-react-app-buildpack.git

When I try to add the line:

var pg = require('pg');

I get the following compilation error when I try to run the heroku app locally:

>heroku local web
[OKAY] Loaded ENV .env File as KEY=VALUE Format
[WARN] ENOENT: no such file or directory, open 'Procfile'
[OKAY] package.json file found - trying 'npm start'
4:15:19 PM web.1 |  > test-app@0.1.0 start /Users/oliverpike/dev/heroku/ofp-react
4:15:19 PM web.1 |  > react-scripts start
4:15:20 PM web.1 |  Starting the development server...
4:15:29 PM web.1 |  Failed to compile.
4:15:29 PM web.1 |  Error in ./~/pg/lib/native/index.js
4:15:29 PM web.1 |  Module not found: 'pg-native' in /Users/oliverpike/dev/heroku/ofp-react/node_modules/pg/lib/native
4:15:29 PM web.1 |   @ ./~/pg/lib/native/index.js 1:13-33
4:15:29 PM web.1 |  Error in ./~/pg/lib/connection-parameters.js
4:15:29 PM web.1 |  Module not found: 'dns' in /Users/oliverpike/dev/heroku/ofp-react/node_modules/pg/lib
4:15:29 PM web.1 |   @ ./~/pg/lib/connection-parameters.js 2:10-24
over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

I was able to get past this issue by doing an:

> npm i pg-native

as described here: https://github.com/brianc/node-pg-native

as well as an

> npm i dns

for the dns issue.

The odd thing was that I didn't need to explicitly install these packages in my other heroku app that is using postgres.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda