2017-01-08 9 views
2

반응이있는 heroku 노드 앱에서 postgres 부가 기능을 사용하려고합니다.오류가 발생했습니다. 모듈을 찾을 수 없습니다 : heroku 앱에서 'pg-native'

나는 Heroku가 내부 반응 지원이 buildpack 반응 사용하고 있습니다 : https://github.com/opike/create-react-app-buildpack.git

나는 줄을 추가하려고 : 나는를 실행하려고 할 때 다음과 같은 컴파일 오류가

var pg = require('pg'); 

을 로컬 Heroku가 응용 프로그램 :

>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 | > [email protected] 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 

답변

1

가 나는를 수행하여이 문제를 과거를 얻을 수 있었다 :

여기에 설명 된대로
> npm i pg-native 

: https://github.com/brianc/node-pg-native

뿐만 아니라 DNS 문제에 대한

> npm i dns 

.

이상한 점은 postgres를 사용하는 다른 heroku 앱에이 패키지를 명시 적으로 설치할 필요가 없다는 것입니다.