brianc / node-libpq

Simple, low level native bindings to PostgreSQL's libpq from node.js
112 stars 42 forks source link

EACCES: permission denied, mkdir '.../node_modules/libpq/build' #43

Open poshest opened 8 years ago

poshest commented 8 years ago

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

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.

rbudiharso commented 6 years ago

over a year and no update on this? bummer

OllieJennings commented 6 years ago

Yeah i am still hitting this issue a lot

stephendeo commented 6 years ago

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.

bazzilio commented 5 years ago

Also hit the issue. I can't hit the permission issue, because build node from the root. :

root@bay7:~/git/mathserver# npm install 

> libpq@1.8.8 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! libpq@1.8.8 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the libpq@1.8.8 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 libpq@1.8.8~install: unsafe-perm in lifecycle false
97 verbose lifecycle libpq@1.8.8~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 libpq@1.8.8~install: CWD: /home/admbay/git/mathserver/node_modules/libpq
99 silly lifecycle libpq@1.8.8~install: Args: [ '-c', 'node-gyp rebuild' ]
100 silly lifecycle libpq@1.8.8~install: Returned: code: 1  signal: null
101 info lifecycle libpq@1.8.8~install: Failed to exec install script
102 timing action:install Completed in 431ms

My Solution: apt install build-essential postgresql-common

Xetera commented 4 years ago

Installing some missing packages

sudo apt install build-essential postgresql-common postgresql-server-dev-10

seems to have fixed the issue for me

nazmuddin commented 3 years ago

Did you find any solution for this? I am using node version 12, postgres 12. And getting the same error.