node-libpq
node-libpq copied to clipboard
EACCES: permission denied, mkdir '.../node_modules/libpq/build'
I'm getting this error when I do a pg-native install, on Ubuntu 12.04.
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/home/vagrant/task/server/node_modules/libpq/build'
gyp ERR! stack at Error (native)
gyp ERR! System Linux 3.2.0-23-generic-pae
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/vagrant/task/server/node_modules/libpq
gyp ERR! node -v v6.2.0
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok
It happens whether I sudo npm
or not. It happens on node versions 0.11, 0.12, 4.3, 6.2. It happens if I manually create and chmod and chown the '/home/vagrant/task/server/node_modules/libpq/build'
directory.
I have the following installed
- gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
- GNU Make 3.81
- Python 2.7.3
- PostgreSQL 9.3.10
- node v6.2.0
- node-gyp v3.3.1
- npm v3.8.9
I have the latest libpq-dev, and pg_config
is in my path.
I'd really love some help. I've Googled, installed, updated, chowned, chmoded, and nothing seems to fix it.
over a year and no update on this? bummer
Yeah i am still hitting this issue a lot
ugh... just ran into this exact same issue today... =( I've tried reinstalling node, updating to the latest version in npm, clearing npm cache and directly calling npm from its global path /usr/local/lib/node/npm to install package.json... and manually giving my dir read and write access... and NOTHING! lol anyone else have any idea why this is happening?
UPDATE: I was able to solve this by rolling back nodejs version. I was running 9.10.1 so I rolled back to a much earlier version 6.10.1 and things started to work.
Also hit the issue. I can't hit the permission issue, because build node from the root. :
root@bay7:~/git/mathserver# npm install
> [email protected] install /home/admbay/git/mathserver/node_modules/libpq
> node-gyp rebuild
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/home/admbay/git/mathserver/node_modules/libpq/build'
gyp ERR! System Linux 4.4.0-134-generic
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/admbay/git/mathserver/node_modules/libpq
gyp ERR! node -v v8.12.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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:
debug logs
96 verbose lifecycle [email protected]~install: unsafe-perm in lifecycle false
97 verbose lifecycle [email protected]~install: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/admbay/git/mathserver/node_modules/libpq/node_modules/.bin:/home/admbay/git/mathserver/node_modules/.bin:/home/admbay/
bin:/home/admbay/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/snap/bin
98 verbose lifecycle [email protected]~install: CWD: /home/admbay/git/mathserver/node_modules/libpq
99 silly lifecycle [email protected]~install: Args: [ '-c', 'node-gyp rebuild' ]
100 silly lifecycle [email protected]~install: Returned: code: 1 signal: null
101 info lifecycle [email protected]~install: Failed to exec install script
102 timing action:install Completed in 431ms
My Solution:
apt install build-essential postgresql-common
Installing some missing packages
sudo apt install build-essential postgresql-common postgresql-server-dev-10
seems to have fixed the issue for me
Did you find any solution for this? I am using node version 12, postgres 12. And getting the same error.