Open ferylukacs opened 7 years ago
I had the same issue and I still do, but I was at some point exactly at the same level as you are and I made some progress reading here.
I have the issue on a windows machine at work and installing the build tools with:
npm install --global --production windows-build-tools
at least got me rid of some of the errors. As I said this helped me partially but hopefully it's a start for you as well.
UPDATE: After that I had to install the windows SDK tools and to create a C++ project from visual studio (maybe I could have done the other way around.. I guess the second thing includes the first) to get rid of another couple of errors. Specifically, the first one was complaining that SDK 8.1 wasn't found, and the second one was something like: "TRACKER : error TRK0005: Failed to locate: "CL.exe"". Ah, also, I had to add C:\Program Files\PostgreSQL\9.5\bin to path to get rid of an error complaining that pg_config is not recognized as an internal or external command.
And.. INCREDIBLE! After all this madness I could finally run npm install and get pg-native! Hope this will help you as well.
I might have missed some point here and there.. It was a bit hard to keep track of everything, let me know if it helps. I really had to waste quite some time on this.
@ferylukacs this sudo apt-get install libpq-dev
solved my problem with this error
For Windows users:
copy paste all .dll files in PostgreSQL's bin directory to C:\Windows
I copied below dll's and it worked, voila! libcurl.dll, libeay32.dll, libiconv-2.dll, libintl-8.dll, libpq.dll, libxml2.dll, libxslt.dll, ssleay32.dll, zlib1.dll
It is still impossible to install pg-native on Windows. Any updates on this?
I get the following error after npm install --global --production windows-build-tools
& npm config set msvs_version 2017
and install visual studio .
PS D:\code\myproject2020\XXX nvm use 14.4.0
Now using node v14.4.0 (64-bit)
PS D:\code\myproject2020\XXX> yarn add pg-native
yarn add v1.22.4
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.2.11: The platform "win32" is incompatible with this module.
info "fsevents@1.2.11" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@2.1.2: The platform "win32" is incompatible with this module.
info "fsevents@2.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@1.2.13: The platform "win32" is incompatible with this module.
info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning " > bookshelf@1.1.0" has incorrect peer dependency "knex@>=0.15.0 <0.21.0".
warning " > rollup-plugin-uglify@6.0.4" has incorrect peer dependency "rollup@>=0.66.0 <2".
[4/4] Building fresh packages...
[-/6] ⠈ waiting...
[-/6] ⠈ waiting...
[-/6] ⠁ waiting...
[-/6] ⠁ waiting...
error D:\code\myproject2020\XXX\node_modules\libpq: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments:
Directory: D:\code\myproject2020\XXX\node_modules\libpq
Output:
D:\code\myproject2020\XXX\node_modules\libpq>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "" rebuild )
gyp info it worked if it ends with ok
gyp info using node-gyp@5.1.0
gyp info using node@14.4.0 | win32 | x64
gyp info find Python using Python version 2.7.15 found at "C:\Users\XXX\.windows-build-tools\python27\python.exe"
gyp http GET https://nodejs.org/download/release/v14.4.0/node-v14.4.0-headers.tar.gz
gyp http 200 https://nodejs.org/download/release/v14.4.0/node-v14.4.0-headers.tar.gz
gyp http GET https://nodejs.org/download/release/v14.4.0/SHASUMS256.txt
gyp http GET https://nodejs.org/download/release/v14.4.0/win-x86/node.lib
gyp http GET https://nodejs.org/download/release/v14.4.0/win-x64/node.lib
gyp http GET https://nodejs.org/download/release/v14.4.0/win-arm64/node.lib
gyp http 200 https://nodejs.org/download/release/v14.4.0/SHASUMS256.txt
gyp http 200 https://nodejs.org/download/release/v14.4.0/win-x64/node.lib
gyp http 200 https://nodejs.org/download/release/v14.4.0/win-x86/node.lib
gyp http 404 https://nodejs.org/download/release/v14.4.0/win-arm64/node.lib
gyp info find VS using VS2017 (15.9.28307.1259) found at:
gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools"
gyp info find VS run with --verbose for detailed information
gyp info spawn C:\Users\XXX\.windows-build-tools\python27\python.exe
gyp info spawn args [
gyp info spawn args 'C:\\Users\\XXX\\AppData\\Roaming\\nvm\\v14.4.0\\node_modules\\npm\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'msvs',
gyp info spawn args '-I',
gyp info spawn args 'D:\\code\\myproject2020\\XXX\\node_modules\\libpq\\build\\config.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Users\\XXX\\AppData\\Roaming\\nvm\\v14.4.0\\node_modules\\npm\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Users\\XXX\\AppData\\Local\\node-gyp\\Cache\\14.4.0\\include\\node\\common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=C:\\Users\\XXX\\AppData\\Local\\node-gyp\\Cache\\14.4.0',
gyp info spawn args '-Dnode_gyp_dir=C:\\Users\\XXX\\AppData\\Roaming\\nvm\\v14.4.0\\node_modules\\npm\\node_modules\\node-gyp',
gyp info spawn args '-Dnode_lib_file=C:\\\\Users\\\\XXX\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\14.4.0\\\\<(target_arch)\\\\node.lib',
gyp info spawn args '-Dmodule_root_dir=D:\\code\\myproject2020\\XXX\\node_modules\\libpq',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'D:\\code\\myproject2020\\XXX\\node_modules\\libpq\\build',
gyp info spawn args '-Goutput_dir=.'
gyp info spawn args ]
'pg_config' �����ڲ����ⲿ���Ҳ���ǿ����еij���
���������ļ���
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\XXX\AppData\Roaming\nvm\v14.4.0\node_modules\npm\node_modules\node-gyp\lib\configure.js:351:16)
gyp ERR! stack at ChildProcess.emit (events.js:315:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)
gyp ERR! System Windows_NT 10.0.17763
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\code\myproject2020\XXX\node_modules\libpq
ENV
system: windows10 1809
node: 14.4.0
Any more updates on this? Windows 10 and I get this error when doing npm install pg-native; `npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!
libpq@1.8.9 install C:\Users\User 1\Desktop\Test\crewasisapp\node_modules\libpq node-gyp rebuild
C:\Users\User 1\Desktop\Test\crewasisapp\node_modules\libpq>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Program Files\nodejs\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:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:351:16)
gyp ERR! stack at ChildProcess.emit (events.js:400:28)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:282:12)
gyp ERR! System Windows_NT 10.0.19041
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\User 1\Desktop\Test\crewasisapp\node_modules\libpq
gyp ERR! node -v v14.18.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm WARN @babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@7.16.0 requires a peer of @babel/core@^7.13.0 but none is installed. You must install peer dependencies yourself.
npm WARN tsutils@3.21.0 requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\watchpack-chokidar2\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\webpack-dev-server\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: 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\User 1\AppData\Roaming\npm-cache_logs\2021-12-18T06_38_18_437Z-debug.log`
Still getting this error. Any way to fix this on Windows 10, as windows-build-tools
(Suggested by @thomscot on this message) is deprecated and apparently - from the error install message - is now included in Node.js
? Any help would be appreciated!
Edit: Just looked at the README.md
, silly Google lead me to this issue, instead of the actual fix provided in the README.md
. I'll ask for more help if it doesn't work, otherwise, toodle-oo!
Linux This helped me https://github.com/brianc/node-pg-native/issues/50#issuecomment-290640707
C:\Users\Username>npm install pg-native
C:\Users\Username\node_modules\libpq>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "" rebuild ) gyp ERR! configure error gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable. gyp ERR! stack at failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:449:14) gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:404:11 gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:264:29 gyp ERR! stack at FSReqWrap.oncomplete (fs.js:123:15) gyp ERR! System Windows_NT 10.0.10586 gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild" gyp ERR! cwd C:\Users\Username\node_modules\libpq gyp ERR! node -v v6.9.4 gyp ERR! node-gyp -v v3.4.0 gyp ERR! not ok npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\Username\package.json' npm WARN Username No description npm WARN UsernameNo repository field. npm WARN Username No README data npm WARN Username No license field. npm ERR! Windows_NT 10.0.10586 npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "pg-native" npm ERR! node v6.9.4 npm ERR! npm v3.10.10 npm ERR! code ELIFECYCLE
npm ERR! libpq@1.8.5 install:
node-gyp rebuild
npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the libpq@1.8.5 install script 'node-gyp rebuild'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the libpq package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node-gyp rebuild npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs libpq npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls libpq npm ERR! There is likely additional logging output above.npm ERR! Please include the following file with any support request: npm ERR! C:\Users\Username\npm-debug.log