You are not logged in.

#1 2015-08-06 00:17:42

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

command not found - npm PATH problems - bash hosed?

one one of my systems, i get command not found for any command i run, from either terminal or ssh.  i cant mv, reboot, vim, nano, anything..

i think i messed up my PATH var, but echo $PATH does yield results.  hmm, wonder if i can wget paste. nope, command not found..

so on /etc/profile i directly edited it,
did something like this to try to set a global path to solve some pretty aggravating node_module npm issues.

NODE_MODULES=/usr/bin/node_modules/bin/bin:/usr/bin/node_modules
export PATH=$PATH:$NODE_MODULES

there may be syntax error on it.  it hosed bash.  not sure if this is the exact code, theres a couple unmentioned entries here.

oddly enough i can echo $PATH from both root (on terminal which is only place i can log in as root, su doesnt work, sudo doesnt work), and on ssh putty (as user, because i cant sudo or cant su)

i dont want to have to use a rescue disk, and frankly not comfortable toggling the off switch because i cant shutdown.


I know theres a way... suggestions?

Last edited by wolfdogg (2015-08-06 02:22:02)


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

Offline

#2 2015-08-06 00:42:21

oliver
Member
Registered: 2007-12-12
Posts: 448

Re: command not found - npm PATH problems - bash hosed?

Apologies if I'm being too simplistic here but what does your PATH actually return?

$ echo $PATH
$ export PATH=$PATH:/usr/bin
$ echo $PATH

(see what your path is, append /usr/bin to it, see your path again)

edit - are you sure about that NODE_MODULES PATH?  Are the binaries really in /usr/bin/node_modules/bin/bin/* ?

Last edited by oliver (2015-08-06 00:47:16)

Offline

#3 2015-08-06 01:06:48

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,810

Re: command not found - npm PATH problems - bash hosed?

If your $PATH is borked, specifying commands with full path should still work: '/usr/bin/vi /etc/profile' etc...


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

#4 2015-08-06 01:21:16

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

Re: command not found - npm PATH problems - bash hosed?

ahh good point on specifying with full commands.   i had just restarted into a rescue disk and i knew i was forgetting a simple thing.  this was it. thanks for the tip.  Ill see if i can edit the files if that was indeed the problem.

and the path @oliver is echoing out the entire path still, sorry i forgot to mention that.  that is the wierd part.  ill get it for you when i can, or if i find the problem..

Last edited by wolfdogg (2015-08-06 01:37:40)


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

Offline

#5 2015-08-06 01:42:16

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

Re: command not found - npm PATH problems - bash hosed?

thanks, it worked to use full path, so heres my suspected failing profile. notice duplicate entries on there, yes... also, anything else wrong, like the way im adding to the path?

# /etc/profile

#Set our umask
umask 022

NODE_MODULES=/usr/bin/node_modules/bin/bin:~/sites/js_codechallenge/node_modules/.bin

# Set our default path
PATH=$NODE_MODULES:/usr/local/sbin:/usr/local/bin:/usr/bin/node_modules/bin/bin
export PATH

# Load profiles from /etc/profile.d
if test -d /etc/profile.d/; then
        for profile in /etc/profile.d/*.sh; do
                test -r "$profile" && . "$profile"
        done
        unset profile
fi

# Source global bash config
if test "$PS1" && test "$BASH" && test -r /etc/bash.bashrc; then
        . /etc/bash.bashrc
fi

# Termcap is outdated, old, and crusty, kill it.
unset TERMCAP

# Man is much better than us at figuring this out
unset MANPATH

export PATH=$PATH:/usr/bin/node_modules/bin/bin:/usr/bin/node_modules/bin

no $sign on 2nd usage of PATH?

so after cleaning it up a bit, will this work, or should i be putting node_modules which i want to test globally somewhere else?

# /etc/profile

#Set our umask
umask 022

NODE_MODULES=/usr/bin/node_modules/bin/bin:/usr/bin/node_modules/bin:~/sites/js_codechallenge/node_modules/.bin

# Set our default path
PATH=$NODE_MODULES:/usr/local/sbin:/usr/local/bin
export $PATH

# Load profiles from /etc/profile.d
if test -d /etc/profile.d/; then
        for profile in /etc/profile.d/*.sh; do
                test -r "$profile" && . "$profile"
        done
        unset profile
fi

# Source global bash config
if test "$PS1" && test "$BASH" && test -r /etc/bash.bashrc; then
        . /etc/bash.bashrc
fi

# Termcap is outdated, old, and crusty, kill it.
unset TERMCAP

# Man is much better than us at figuring this out
unset MANPATH

lame, i guess the ~/ directory is wrong too, because thats in a userdir, not roots...  or will ~/sites/js_codechallenge work for all users, if the directory exists?

Last edited by wolfdogg (2015-08-06 01:48:21)


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

Offline

#6 2015-08-06 01:52:38

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

Re: command not found - npm PATH problems - bash hosed?

yep still not helping, this is what i see as user

$ echo $PATH
/usr/bin/node_modules/bin/bin:/usr/bin/node_modules/bin:/home/wolfdogg/sites/js_codechallenge/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/usr/lib/node_modules/grunt:/usr/lib/node_modules/grunt-js:/usr/bin/node_modules/bin/bin:/home/wolfdogg/sites/js_codechallenge/node_modules/.bin:/usr/lib/node_modules/grunt:/usr/lib/node_modules/grunt-js:/usr/lib/node_modules/grunt:/usr/lib/node_modules/grunt-js

and root

echo $PATH
/usr/bin/node_modules/bin/bin:/usr/bin/node_modules/bin:/home/wolfdogg/sites/js_codechallenge/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/usr/lib/node_modules/grunt:/usr/lib/node_modules/grunt-js:/usr/bin/node_modules/bin/bin:/home/wolfdogg/sites/js_codechallenge/node_modules/.bin:/usr/lib/node_modules/grunt:/usr/lib/node_modules/grunt-js

  that s... needs some serious TLC...   

Can i turn this into an NPM  / Path thread admins?

Last edited by wolfdogg (2015-08-06 01:54:17)


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

Offline

#7 2015-08-06 02:13:27

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

Re: command not found - npm PATH problems - bash hosed?

ok what a mess, i fixed it, multiple problems, i also noticed /usr/bin was missing... geese...   

# /etc/profile

#Set our umask
umask 022

# Set our default path
NODE_MODULES=/usr/bin/node_modules/bin/bin:/usr/bin/node_modules/bin
export PATH="/usr/local/sbin:/usr/local/bin:/usr/bin:$NODE_MODULES"

# Load profiles from /etc/profile.d
if test -d /etc/profile.d/; then
        for profile in /etc/profile.d/*.sh; do
                test -r "$profile" && . "$profile"
        done
        unset profile
fi

# Source global bash config
if test "$PS1" && test "$BASH" && test -r /etc/bash.bashrc; then
        . /etc/bash.bashrc
fi

# Termcap is outdated, old, and crusty, kill it.
unset TERMCAP

# Man is much better than us at figuring this out
unset MANPATH
# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/node_modules/bin/bin:/usr/bin/node_modules/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl

onwards and upwards, to the npm path issues i go now. . im going to keep posting here unless somebody want to split the post....  '

Last edited by wolfdogg (2015-08-06 02:14:47)


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

Offline

#8 2015-08-06 02:17:13

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: command not found - npm PATH problems - bash hosed?

Stop bumping the thread: use the edit button.

You exported PATH twice in your /etc/profile, so only the second (without the standard entries) was used.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#9 2015-08-06 02:21:16

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

Re: command not found - npm PATH problems - bash hosed?

Next problem, which caused this in the first place.  npm... see wiki https://wiki.archlinux.org/index.php/Node.js (first off i dont call npm node.js, and never had to adress 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 out of my userdir, i want to install the package out of my userdir, so i do this

$cd ~/sites/
$ mkdir 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)

Edit: note there, im not done editing this, but ill stop and make an edit for you here. i intentionally did a logical bump.  it wouldn't have made sense to me to edit 50 times to my initial reply, sorry.  Then people seem to get even more mad at me :-)

Last edited by wolfdogg (2015-08-06 02:24:56)


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

Offline

#10 2015-08-06 02:26:27

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: command not found - npm PATH problems - bash hosed?

So this isn't related to the thread title at all now? Read the Etiquette: https://wiki.archlinux.org/index.php/Fo … ow_to_post



Closing


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

Board footer

Powered by FluxBB