2

プロジェクトに node-postgres をセットアップしようとしています。ただし、インストールしようとすると、これらの gyp エラーが発生し続けます。pg_config が /Library/PostgreSQL/9.3/bin/pg_config にあることを node-postgres に認識させるにはどうすればよいですか。私のお気に入りの検索エンジンの結果は、次のようにするように指示したためです。

➜  src git:(master) ✗ PG_CONFIG=/Library/PostgreSQL/9.3/bin/pg_config
➜  src git:(master) ✗ export PG_CONFIG
➜  src git:(master) ✗ sudo npm install pg
Password:
npm WARN package.json test@0.1.0 No repository field.
npm http GET https://registry.npmjs.org/pg
npm http 304 https://registry.npmjs.org/pg
npm http GET https://registry.npmjs.org/generic-pool/2.0.3
npm http GET https://registry.npmjs.org/buffer-writer/1.0.0
npm http GET https://registry.npmjs.org/pgpass/0.0.1
npm http GET https://registry.npmjs.org/nan
npm http 304 https://registry.npmjs.org/nan
npm http 304 https://registry.npmjs.org/pgpass/0.0.1
npm http 304 https://registry.npmjs.org/buffer-writer/1.0.0
npm http 304 https://registry.npmjs.org/generic-pool/2.0.3
npm http GET https://registry.npmjs.org/split
npm http 304 https://registry.npmjs.org/split
npm http GET https://registry.npmjs.org/through
npm http 304 https://registry.npmjs.org/through

> pg@2.11.1 install /Users/me/test/src/node_modules/pg
> node-gyp rebuild || (exit 0)

/bin/sh: pg_config: command not found
gyp: Call to 'pg_config --libdir' returned exit status 127.
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:337:16)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:789:12)
gyp ERR! System Darwin 13.0.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/me/test/src/node_modules/pg
gyp ERR! node -v v0.10.24
gyp ERR! node-gyp -v v0.12.1
gyp ERR! not ok
pg@2.11.1 node_modules/pg
├── nan@0.6.0
├── generic-pool@2.0.3
├── buffer-writer@1.0.0
└── pgpass@0.0.1 (split@0.2.10)
➜  src git:(master) ✗
4

1 に答える 1

9

ノード構築ツールが環境変数を見ていないようですPG_CONFIG:

/bin/sh: pg_config: コマンドが見つかりません

代わりに追加しPATHます:

export PATH=/Library/PostgreSQL/9.3/bin:$PATH
于 2014-02-11T22:52:22.180 に答える