我目前正在努力将pg-native依赖项安装到我的项目文件夹中。当我尝试运行index.js时,它说它无法“解析pg-native依赖项”,尽管我不相信我称呼它。但是,假设我这样做了,我尝试安装依赖项并在尝试执行以下操作时得到此错误屏幕:
C:\Users\jmurr\Documents\MSDPP-Map>npm i pg-native
> libpq@1.8.9 install C:\Users\jmurr\Documents\MSDPP-Map\node_modules\libpq
> node-gyp rebuild
C:\Users\jmurr\Documents\MSDPP-Map\node_modules\libpq>if not defined npm_config_node_gyp (node "C:\Users\jmurr\AppData\Roaming\nvm\v8.11.4\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Users\jmurr\AppData\Roaming\nvm\v8.11.4\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
'pg_config' is not recognized as an internal or external command,
operable program or batch file.
gyp: Call to 'pg_config --libdir' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (C:\Users\jmurr\AppData\Roaming\nvm\v8.11.4\node_modules\npm\node_modules\node-gyp\lib\configure.js:336:16)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Windows_NT 10.0.18362
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\jmurr\\AppData\\Roaming\\nvm\\v8.11.4\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\jmurr\Documents\MSDPP-Map\node_modules\libpq
gyp ERR! node -v v8.11.4
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN msdpp_map@1.0.0 No description
npm WARN msdpp_map@1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! libpq@1.8.9 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the libpq@1.8.9 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\jmurr\AppData\Roaming\npm-cache\_logs\2019-11-14T02_44_05_069Z-debug.log
如Windows此处https://www.npmjs.com/package/pg-native所述,在安装之前,我竭尽全力正确设置了所有内容。但是,它仍然不起作用。我可能做错了一件事情,希望这里有人可以帮助我解决过去几天遇到的挫败感。谢谢您的时间!