You are not logged in.

#1 2015-08-06 02:29:58

wolfdogg
Member
From: Portland, OR, USA
Registered: 2011-05-21
Posts: 545

PATH issue npm [solved]

Im having PATH problems here EACCESS is a commen term that pops up.  Am i missing something in my PATH?

see wiki https://wiki.archlinux.org/index.php/Node.js (IMO, i dont call npm node.js, and never had to address it as such until now, so it would be great if we can have an npm package wiki that isnt under an umbrella of node.js.  its not useful that way imo.)

So, following that it talks about adding this to your user bash profile..

PATH=$PATH:~/.node_modules/bin
export npm_config_prefix=~/.node_modules

This is very vague.  first off, i want to install globally, -g, user not only needs to sudo, or be root to do that, but also needs to sudo or root to even install this package inside a website, as a dependency inside their userdir.  this is where it gets confusing.
This is where the paths get confusing too.
So, i have an app im developing IN my userdir, i want to install the package IN my userdir, so i do this

$ mkdir ~/sites/npmtestpathsite
$ cd npmtestpathsite
$ npm install deployd
npm ERR! Linux 4.1.3-1-ARCH
npm ERR! argv "node" "/usr/bin/npm" "install" "deployd"
npm ERR! node v0.12.7
npm ERR! npm  v2.13.2
npm ERR! path /home/wolfdogg/sites/node_modules/.bin/dpd
npm ERR! code EACCES
npm ERR! errno -13

npm ERR! Error: EACCES, unlink '/home/wolfdogg/sites/node_modules/.bin/dpd'
npm ERR!     at Error (native)
npm ERR!  { [Error: EACCES, unlink '/home/wolfdogg/sites/node_modules/.bin/dpd']
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   path: '/home/wolfdogg/sites/node_modules/.bin/dpd' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! error rolling back Error: EACCES, unlink '/home/wolfdogg/sites/node_modules/.bin/dpd'
npm ERR! error rolling back     at Error (native)
npm ERR! error rolling back  { [Error: EACCES, unlink '/home/wolfdogg/sites/node_modules/.bin/dpd']
npm ERR! error rolling back   errno: -13,
npm ERR! error rolling back   code: 'EACCES',
npm ERR! error rolling back   path: '/home/wolfdogg/sites/node_modules/.bin/dpd' }

npm ERR! Please include the following file with any support request:
npm ERR!     /home/wolfdogg/sites/npmtestpathsite/npm-debug.log

so we do it sudo, it claims root problems

$ sudo npm install deployd

> bufferutil@1.1.0 install /home/wolfdogg/sites/node_modules/deployd/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/bufferutil
> node-gyp rebuild

gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/0.12.7"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/home/wolfdogg/sites/node_modules/deployd/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/bufferutil/.node-gyp"
make: Entering directory '/home/wolfdogg/sites/node_modules/deployd/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/bufferutil/build'
  CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
  SOLINK_MODULE(target) Release/obj.target/bufferutil.node
  COPY Release/bufferutil.node
make: Leaving directory '/home/wolfdogg/sites/node_modules/deployd/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/bufferutil/build'

> utf-8-validate@1.1.0 install /home/wolfdogg/sites/node_modules/deployd/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/utf-8-validate
> node-gyp rebuild

gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/0.12.7"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/home/wolfdogg/sites/node_modules/deployd/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/utf-8-validate/.node-gyp"
make: Entering directory '/home/wolfdogg/sites/node_modules/deployd/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/utf-8-validate/build'
  CXX(target) Release/obj.target/validation/src/validation.o
  SOLINK_MODULE(target) Release/obj.target/validation.node
  COPY Release/validation.node
make: Leaving directory '/home/wolfdogg/sites/node_modules/deployd/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/utf-8-validate/build'

> bufferutil@1.1.0 install /home/wolfdogg/sites/node_modules/deployd/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/node_modules/bufferutil
> node-gyp rebuild

gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/0.12.7"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/home/wolfdogg/sites/node_modules/deployd/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/node_modules/bufferutil/.node-gyp"
make: Entering directory '/home/wolfdogg/sites/node_modules/deployd/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/node_modules/bufferutil/build'
  CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
  SOLINK_MODULE(target) Release/obj.target/bufferutil.node
  COPY Release/bufferutil.node
make: Leaving directory '/home/wolfdogg/sites/node_modules/deployd/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/node_modules/bufferutil/build'

> utf-8-validate@1.1.0 install /home/wolfdogg/sites/node_modules/deployd/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/node_modules/utf-8-validate
> node-gyp rebuild

gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/0.12.7"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/home/wolfdogg/sites/node_modules/deployd/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/node_modules/utf-8-validate/.node-gyp"
make: Entering directory '/home/wolfdogg/sites/node_modules/deployd/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/node_modules/utf-8-validate/build'
  CXX(target) Release/obj.target/validation/src/validation.o
  SOLINK_MODULE(target) Release/obj.target/validation.node
  COPY Release/validation.node
make: Leaving directory '/home/wolfdogg/sites/node_modules/deployd/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/node_modules/utf-8-validate/build'
deployd@0.8.5 ../node_modules/deployd
├── opener@1.4.1
├── scrubber@0.0.0
├── validation@0.0.1
├── corser@2.0.0
├── step@0.0.5
├── qs@2.4.2
├── async@0.9.2
├── underscore@1.8.3
├── wrench@1.5.8
├── debug@2.2.0 (ms@0.7.1)
├── cookies@0.5.0 (keygrip@1.0.1)
├── commander@2.8.1 (graceful-readlink@1.0.1)
├── filed@0.1.0 (mime@1.3.4)
├── shelljs@0.4.0
├── semver@4.3.6
├── mkdirp@0.5.1 (minimist@0.0.8)
├── send@0.12.3 (destroy@1.0.3, fresh@0.2.4, escape-html@1.0.1, range-parser@1.0.2, ms@0.7.1, depd@1.0.1, mime@1.3.4, on-finished@2.2.1, etag@1.6.0)
├── doh@0.0.4 (ejs@0.8.8)
├── ejs@2.3.3
├── bluebird@2.9.34
├── request@2.55.0 (caseless@0.9.0, aws-sign2@0.5.0, forever-agent@0.6.1, form-data@0.2.0, stringstream@0.0.4, oauth-sign@0.6.0, tunnel-agent@0.4.1, isstream@0.1.2, json-stringify-safe@5.0.1, node-uuid@1.4.3, combined-stream@0.0.7, mime-types@2.0.14, http-signature@0.10.1, bl@0.9.4, tough-cookie@2.0.0, hawk@2.3.1, har-validator@1.8.0)
└── socket.io@1.3.6 (debug@2.1.0, has-binary-data@0.1.3, socket.io-adapter@0.3.1, socket.io-parser@2.2.4, engine.io@1.5.2, socket.io-client@1.3.6)
$ echo $PATH
/home/wolfdogg/.wp-cli/bin:/usr/bin/node_modules/bin/bin:/home/wolfdogg/sites/js_codechallenge/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/usr/lib/node_modules/grunt:/usr/lib/node_modules/grunt-js

im constantly getting issues like this

$ dpd create mysite
to start your app:
        $ cd mysite
        $ dpd
[wolfdogg@falcon npmtestpathsite]$ cd mysite
[wolfdogg@falcon mysite]$ dpd
starting deployd v0.8.4...
Failed to start MongoDB (Make sure 'mongod' are in your $PATH or use dpd --mongod option. Ref: http://docs.deployd.com/docs/basics/cli.html)
bye

$ dpd --mongod
starting deployd v0.8.4...
child_process.js:1136
  var err = this._handle.spawn(options);
                         ^
TypeError: Bad argument
    at TypeError (native)
    at ChildProcess.spawn (child_process.js:1136:26)
    at exports.spawn (child_process.js:995:9)
    at Object.exports.restart (/usr/bin/node_modules/bin/lib/node_modules/deployd/lib/util/mongod.js:38:14)
    at start (/usr/bin/node_modules/bin/lib/node_modules/deployd/bin/dpd:149:16)
    at Object.<anonymous> (/usr/bin/node_modules/bin/lib/node_modules/deployd/bin/dpd:280:31)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:501:10)
    at startup (node.js:129:16)
    at node.js:814:3

I would like to know what others are doing out there, and if there is a brilliant path solution, wether it shoudl be put on /etc/profile, or on a users bash_profile, or something, to get npm working better.  Im thinking of sticking with bin/bin and just ln -s everything i use in my apps to bin/bin and be done with it.  But am i missing something? What im suggestion for a solution is this, and i can use some help. 
Set PATH on /etc/profile for all npm global installations, so maybe adding /usr/bin/node_module/bin to your PATH entry on /etc/profile,
then from there install all node modules as sudo only, from the user needing modules, probably needing to be inside the website directory incase it outputs a node_modules subdir there too when ran from sudo, or does it output the node_modules to /usr/bin/node_modules only when you run it as sudo?  And always use the -g switch
e.g.

cd sites/yournpmsite
sudo npm isntall -g deployd

then if you need the thing too inside your app too as a dependency, follow up with

$ cd sites/yournpmsite
$ npm install deployd

so that it will end up inside yournpmsite/node_modules where you can deploy retain a copy of the npm module in your app for safekeeping or whatever reason.

If i can figure this out in time, i might not lose my job interview whos waiting for code samples :-)

Last edited by wolfdogg (2015-08-16 00:47:25)


Node.js, PHP Software Architect and Engineer (Full-Stack/DevOps)
GitHub  | LinkedIn

Offline

#2 2015-08-06 06:54:00

dice
Member
From: Germany
Registered: 2014-02-10
Posts: 413

Re: PATH issue npm [solved]

As npm wasn't using your prefix you might have forgotten to logout and back in?
What are the permissions on those directories npm tries to aaccess and can't?
And are you trying to install globally or per user? You were quite confusing about this..


I put at button on it. Yes. I wish to press it, but I'm not sure what will happen if I do.  (Gune | Titan A.E.)

Offline

#3 2015-08-16 00:47:11

wolfdogg
Member
From: Portland, OR, USA
Registered: 2011-05-21
Posts: 545

Re: PATH issue npm [solved]

Sorry about that, i thik i was trying to get my thoughts on paper before i forgot them, and just idd a bad job at reediting them.  My brain is just fried like that, you guys are going to have to deal with me like that :-)  its all i got.., @jasonwryan for e.g., So in teh end it was a permission issue on the Bin itself, and stretched far and wide, kinda.  See here for the details.   http://stackoverflow.com/questions/3182 … 2#31847882

Last edited by wolfdogg (2015-08-16 00:47:52)


Node.js, PHP Software Architect and Engineer (Full-Stack/DevOps)
GitHub  | LinkedIn

Offline

Board footer

Powered by FluxBB