看到错误模块未find:“pg-native”在heroku应用程序
我正在尝试使用postgres插件和一个也在使用react的heroku节点应用程序。
我正在使用这个反应buildpack支持heroku中的反应: 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 | > 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
我能够通过这样做来解决这个问题:
> npm i pg-native
如下所述: https : //github.com/brianc/node-pg-native
以及一个
> npm i dns
为DNS问题。
奇怪的是,我不需要明确安装这些包在我使用postgres的其他heroku应用程序。
- 使用CORS与LocomotiveJs Rest API。 适用于本地机器,但不适用于Amazon或Heroku
- 我不必为我的socket.io应用程序指定一个用于heroku的端口?
- 在Heroku上找不到的Jade模板
- 快速应用程序 – 在Heroku上运行,并使用Parse作为后端
- npm错误ELIFECYCLE ctrl + c
- 我如何在heroku上设置一个节点应用程序(ember app kit)来读取ENVvariables,并使值可用于应用程序?
- 如何在debugging时通过Eclipse调用工头
- 无法从本地节点应用程序以sequelize连接到heroku postgresql数据库
- 如何使用NodeJS将Postgres数据库迁移到heroku?