node.js npm error when installing plugins with -g - node.js

Trying to install express globally and gets this error. I'm running the node.js version 0.10.24 on my x86 qnap.
[/share/Qweb/Codiad/workspace/chat] # npm install express -g
npm ERR! Error: setuid user id does not exist
npm ERR! at /share/MD0_DATA/.qpkg/Optware/lib/node_modules/npm/node_modules/uid-number/uid-number.js:44:16
npm ERR! at ChildProcess.exithandler (child_process.js:635:7)
npm ERR! at ChildProcess.EventEmitter.emit (events.js:98:17)
npm ERR! at maybeClose (child_process.js:735:16)
npm ERR! at Socket. (child_process.js:948:11)
npm ERR! at Socket.EventEmitter.emit (events.js:95:17)
npm ERR! at Pipe.close (net.js:466:12)
npm ERR! If you need help, you may report this entire log,
npm ERR! including the npm and node versions, at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! System Linux 3.4.6
npm ERR! command "/opt/bin/node" "/opt/bin/npm" "install" "express" "-g"
npm ERR! cwd /share/MD0_DATA/Qweb/Codiad/workspace/chat
npm ERR! node -v v0.10.24
npm ERR! npm -v 1.3.21
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /share/MD0_DATA/Qweb/Codiad/workspace/chat/npm-debug.log
npm ERR! not ok code 0

npm tool does not work correctly in QNAP OS
The work-around is telling npm that QNAP does not support get or set user-id by modifying npm source code:
Open file uid-number.js in your editor:
/share/MD0_DATA/.qpkg/Optware/lib/node_modules/npm/node_modules/uid-number/uid-‌​number.js
Goto line 11 and replace uidSupport = process.getuid && process.setuid with uidSupport = false

QNAP lacks couple of system users available on Linux systems and hence some software does not work properly on QNAP with out-of-the-box configuration, node included.
Solution to your problem: create user nobody. You can use adduser -D -H nobody
or NAS's web ui.
Good luck!

Node.js v5.8.0 download page
try this: node-upgrade.sh
#!/bin/sh
URL=$1
[[ $URL =~ (node-v5\.8\.0-.*)\.tar\.gz$ ]] && TARFile=${BASH_REMATCH[0]} && DirName=${BASH_REMATCH[1]}
[[ $TARFile == "" ]] && echo "url is wrong" && exit
NodeJSPath=$(/sbin/getcfg nodejs Install_Path -f /etc/config/qpkg.conf)
wget --no-check-certificate $URL
tar zxf $TARFile -C $NodeJSPath
rm -r $NodeJSPath/node $TARFile
ln -s $NodeJSPath/$DirName $NodeJSPath/node
uidscript=$NodeJSPath/$DirName/lib/node_modules/npm/node_modules/uid-number/uid-number.js
script="$(cat $uidscript)"
echo "${script/", uidSupport = process.getuid && process.setuid"/, uidSupport = false}" > $uidscript
e.g.
my qnap nas is Intel x86-based series
sh ./node-upgrade.sh https://nodejs.org/download/release/v5.8.0/node-v5.8.0-linux-x86.tar.gz

Related

Fatal error: Unable to find local grunt. Even after making changes to bash_profile

I've followed several of the answers from other posts, but am still getting the same error. I am using mean.io framework for my project and am supposed to use the command grunt in terminal to run my server.
grunt -version:
grunt-cli v0.1.13
.bash_profile:
ESC="\033" # This is the escape sequence
NO_COLOR="$ESC[0m"
IRED="$ESC[1;31m" # ANSI color code for intense/bold red
IGRN="$ESC[1;32m" # ANSI color code for intense/bold green
# From http://railstips.org/blog/archives/2009/02/02/bedazzle-your-bash-prompt-with-git-info/
# I had to change 'git-symbolic-ref' to 'git symbolic-ref'
function parse_git_branch {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo " ["${ref#refs/heads/}"]" # I wanted my branch wrapped in [], use () or <> or whatever
}
# from http://ariejan.net/2010/04/25/ruby-version-and-gemset-in-your-bash-prompt-yes-sir
function rvm_version {
local gemset=$(echo $GEM_HOME | awk -F'#' '{print $2}')
[ "$gemset" != "" ] && gemset="#$gemset"
local version=$(echo $MY_RUBY_HOME | awk -F'-' '{print $2}')
[ "$version" != "" ] && version="$version"
local full="$version$gemset"
[ "$full" != "" ] && echo "${full}:" # the colon at the end is a delimiter, you could use a space instead
}
#PS1="\h:\W \u\$" # For reference, here's the default OS X prompt
#export PS1="\$(rvm_version)\W \$(parse_git_branch)\$ " # Without the colors
# I had to put the \[ and \] down here, as opposed to $IRED, to avoid wrapping funkiness.
export PS1="\[$IRED\]\$(rvm_version)\[$NO_COLOR\]\W\[$IGRN\]\$(parse_git_branch)\[$NO_COLOR\] \$ "
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
export PATH=/usr/local/share/npm/bin:/Users/kelvinyu/.rvm/gems/ruby-2.0.0-p247#railstuorial_rails_4_0/bin:/Users/kelvinyu/.rvm/gems/ruby-2.0.0-p247#global/bin:/Users/kelvinyu/.rvm/rubies/ruby-2.0.0-p247/bin:/Users/kelvinyu/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/opt/sm/bin:/opt/sm/pkg/active/bin:/opt/sm/pkg/active/sbin
export PATH=/usr/local/share/npm/bin:/Users/kelvinyu/.rvm/gems/ruby-2.0.0-p247#railstuorial_rails_4_0/bin:/Users/kelvinyu/.rvm/gems/ruby-2.0.0-p247#global/bin:/Users/kelvinyu/.rvm/rubies/ruby-2.0.0-p247/bin:/Users/kelvinyu/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/opt/sm/bin:/opt/sm/pkg/active/bin:/opt/sm/pkg/active/sbin
export PATH=/usr/local/share/npm/bin:/Users/kelvinyu/.rvm/gems/ruby-2.0.0-p247#railstuorial_rails_4_0/bin:/Users/kelvinyu/.rvm/gems/ruby-2.0.0-p247#global/bin:/Users/kelvinyu/.rvm/rubies/ruby-2.0.0-p247/bin:/Users/kelvinyu/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/opt/sm/bin:/opt/sm/pkg/active/bin:/opt/sm/pkg/active/sbin
export PATH=/usr/local/share/npm/bin:/Users/kelvinyu/.rvm/gems/ruby-2.0.0-p247#railstuorial_rails_4_0/bin:/Users/kelvinyu/.rvm/gems/ruby-2.0.0-p247#global/bin:/Users/kelvinyu/.rvm/rubies/ruby-2.0.0-p247/bin:/Users/kelvinyu/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/opt/sm/bin:/opt/sm/pkg/active/bin:/opt/sm/pkg/active/sbin
export PATH=/usr/local/Cellar/node/0.10.24/bin/:$PATH
export PATH=/usr/local/lib/node_modules/grunt/bin:$PATH
Any help would be greatly appreciated as I need the server to test my routes and controllers. Please let me know if more information is required.
Error from running npm install:
npm http GET https://registry.npmjs.org/grunt-contrib-watch
npm http GET https://registry.npmjs.org/grunt-contrib-jshint
npm http GET https://registry.npmjs.org/grunt-concurrent
npm http GET https://registry.npmjs.org/grunt-mocha-test
npm http 304 https://registry.npmjs.org/grunt-contrib-jshint
npm http 304 https://registry.npmjs.org/grunt-concurrent
npm http 304 https://registry.npmjs.org/grunt-contrib-watch
npm http 304 https://registry.npmjs.org/grunt-mocha-test
> mean#0.1.2 postinstall /Users/kelvinyu/fullstack/pleasetakeit
> node node_modules/bower/bin/bower install
bower EMALFORMED Failed to read /Users/kelvinyu/fullstack/pleasetakeit/bower.json
Additional error details:
Unexpected token }
npm ERR! mean#0.1.2 postinstall: `node node_modules/bower/bin/bower install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mean#0.1.2 postinstall script.
npm ERR! This is most likely a problem with the mean package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node node_modules/bower/bin/bower install
npm ERR! You can get their info via:
npm ERR! npm owner ls mean
npm ERR! There is likely additional logging output above.
npm ERR! System Darwin 13.1.0
npm ERR! command "/usr/local/Cellar/node/0.10.24/bin/node" "/usr/local/Cellar/node/0.10.24/bin/npm" "install"
npm ERR! cwd /Users/kelvinyu/fullstack/pleasetakeit
npm ERR! node -v v0.10.24
npm ERR! npm -v 1.3.21
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/kelvinyu/fullstack/pleasetakeit/npm-debug.log
npm ERR! not ok code 0

error when type 'sudo npm install -g meteorite'

I'm trying to install the meteorite. I've success to install nodejs(v0.10.7).and when I type 'sudo npm install -g meteorite'. It comes the error below. I think it may exist some problem with npm(1.2.21). But I do not how to solve it. And I use ubuntu12.10 64bit. Any ideas?
npm http GET https://registry.npmjs.org/meteorite
npm http 304 https://registry.npmjs.org/meteorite
npm ERR! Error: ENOTDIR, mkdir '/home/icarus/tmp/npm-5885/1369411459617-0.27502001402899623'
npm ERR! If you need help, you may report this log at:
npm ERR! or email it to:
npm ERR! npm-#googlegroups.com
npm ERR! System Linux 3.5.0-17-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "-g" "meteorite"
npm ERR! cwd /home/icarus
npm ERR! node -v v0.10.7
npm ERR! npm -v 1.2.21
npm ERR! not ok code 0
For those who landed here first like me, this is usually an issue with a tmp folder in your root directory followed by npm trying to install from the cache. This should fix it:
rm -rf ~/tmp
sudo npm cache clear
sudo npm install -g meteorite
If you still get the ENOTDIR error you can try making the directory yourself, clearing the cache, and reinstalling, but it looks like removing the tmp folder usually does the trick.
Props to Coombesy for posting this solution here.

How to install jasmine-node (without using 'sudo' ideally)?

So I'm a pretty spoiled rubyist and basically never have to install anything using sudo anymore. I've installed node.js and npm (granted, using the Mac 64-bit .pkg, which could have done gosh knows what on my system) and they work fine.
Now, executing the following:
npm install jasmine-node -g
Doesn't work and says, "Please try running this command again as root/Administrator." which I take to mean sudo npm install jasmine-node -g
Doing: npm install jasmine-node (not globally) works fine, but doesn't setup my path correctly, doesn't run from the command line, etc.
How should I install jasmine-node? cd to /usr/local/bin and install it (without the '-g' option) there? Use homebrew? Or use the sudo ... command I listed above?
Thanks.
/UPDATE: As mentioned above, I installed node.js & npm on my Lion OS X Mac (64-bit) using the universal installer and here are my node/npm listings in /usr/local/bin, in case they're of help:
-rwxr-xr-x 1 24561 wheel 355 Apr 11 2012 /usr/local/bin/node-waf
-rwxr-xr-x 1 24561 wheel 18930304 Oct 25 14:07 /usr/local/bin/node
lrwxr-xr-x 1 root admin 38 Nov 12 10:00 /usr/local/bin/npm -> ../lib/node_modules/npm/bin/npm-cli.js
Also, I found this answer, which is one other option (in addition to the three I presented above).
Please let me know which method is recommended (again, ideally without using 'sudo' is my preference).
/END UPDATE
Here is what doing it with -g (globally) returns (not using sudo):
npm http GET https://registry.npmjs.org/jasmine-node
npm http 200 https://registry.npmjs.org/jasmine-node
npm http GET https://registry.npmjs.org/jasmine-node/-/jasmine-node-1.0.26.tgz
npm http 200 https://registry.npmjs.org/jasmine-node/-/jasmine-node-1.0.26.tgz
npm ERR! Error: EACCES, mkdir '/usr/local/lib/node_modules/jasmine-node'
npm ERR! { [Error: EACCES, mkdir '/usr/local/lib/node_modules/jasmine-node']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/usr/local/lib/node_modules/jasmine-node',
npm ERR! fstream_type: 'Directory',
npm ERR! fstream_path: '/usr/local/lib/node_modules/jasmine-node',
npm ERR! fstream_class: 'DirWriter',
npm ERR! fstream_stack:
npm ERR! [ 'DirWriter._create (/usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23)',
npm ERR! '/usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:37:53',
npm ERR! 'Object.oncomplete (fs.js:297:15)' ] }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Darwin 11.4.2
npm ERR! command "node" "/usr/local/bin/npm" "install" "jasmine-node" "-g"
npm ERR! cwd /Users/brad/play/troles
npm ERR! node -v v0.8.14
npm ERR! npm -v 1.1.65
npm ERR! path /usr/local/lib/node_modules/jasmine-node
npm ERR! fstream_path /usr/local/lib/node_modules/jasmine-node
npm ERR! fstream_type Directory
npm ERR! fstream_class DirWriter
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, mkdir '/usr/local/lib/node_modules/jasmine-node'
npm ERR! fstream_stack DirWriter._create (/usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23)
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:37:53
npm ERR! fstream_stack Object.oncomplete (fs.js:297:15)
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/brad/play/troles/npm-debug.log
npm ERR! not ok code 0
When not using the -g (global install) option, "executables go in ./node_modules/.bin/".
I don't use the -g myself. If you really don't want to install it globally, you can install jasmine-node in your $HOME and add $HOME/node_modules/.bin to the $PATH variable.
I just changed the ownership of all the folders node was concerned with.
sudo chown -R my_account_name /usr/local/lib/node_modules/
sudo chown -R my_account_name /usr/local/lib/node/
sudo chown -R my_account_name /usr/local/include/node/
I don't really know if that's bad practice, but I don't really give a damn.
When you run npm install -g somepackage, you may get an EACCES error asking you to run the command again as root/Administrator. It's a permissions issue.
It's easy to fix, open your terminal (Applications > Utilities > Terminal)
sudo chown -R $USER /usr/local
** I strongly recommend you to not use the package management with sudo (sudo npm -g install something), because you can get some issues later **
Reference: http://foohack.com/2010/08/intro-to-npm/
** Recommended way **
The reason is because this can cause permissions problems with lots of other apps, so I'd suggest not doing this.
A better solution when you are installing in global:
sudo chown -R whoami ~/.npm
So it seems that the node and npm community has finally (in the past year) worked out a method for installing npm and node without needing to use sudo.
Since I'm on Mac OS X, I found these instructions worked for me to uninstall node & npm, then I just used brew to install npm (which automatically gives one node as well). You may need to sudo uninstall, btw, if you sudo'ed to install.
If the above linked instructions don't work, try the top-voted (1500+ votes) answer to do it a bit more manually.
Now having done that, jasmine-node installs just fine w/o sudo, any chowning, or any permissions wrangling. Just run npm install jasmine-node -g and all is well.

Node.js: How to install NPM

I have cygwin and node.exe (0.5.7) installed on my window XP.
When I git clone npm(1.0.30), cd npm, then "make install", there are lots of node_modules cloning.
But it stopped when execute "node cli.js install git+https://github.com/isaac/ronnjs.git".
The following is my npm-debug.log.
info it worked if it ends with ok
verbose cli [ 'E:\node\node.exe', verbose cli
'e:\github\npm\cli.js', verbose cli 'cache', verbose cli
'clean' ] info using npm#1.0.30 info using node#v0.5.7
verbose config file C:\Documents and Settings\zhangchiqing.npmrc
verbose config file E:\etc\npmrc ERR! prefix directory not
found ERR! Error: ENOENT, �����ɹ����ɡ� ERR! 'E:' ERR!
Report this entire log at: ERR!
http://github.com/isaacs/npm/issues ERR! or email it to: ERR!
npm-#googlegroups.com ERR! ERR! System Windows_NT
5.1.2600 ERR! command "E:\node\node.exe" "e:\github\npm\cli.js" "cache" "clean" ERR! cwd E:\github\npm ERR! node -v v0.5.7
ERR! npm -v 1.0.30 verbose exit [ 1, true ]
This works in Ubuntu. You have to use older version of node.
sudo apt-get install -y g++ libssl-dev apache2-utils curl git-core
git clone git://github.com/joyent/node.git
cd node
git checkout v0.4.11
./configure
make
sudo make install
node -v
curl https://npmjs.org/install.sh | sudo sh
npm -v

Node.js : NPM Install Fails

I get this error if I run
curl http://npmjs.org/install.sh | sh
even with sudo.
cirk#cirk-Parallels-Virtual-Platform:~$ curl http://npmjs.org/install.sh | sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 3902 100 3902 0 0 6138 0 --:--:-- --:--:-- --:--:-- 12546
fetching: http://registry.npmjs.org/npm/-/npm-1.0.18.tgz
0.4.9
1.0.18
Skipping 0.x cruft clean
! [ -d .git ] || git submodule update --init --recursive
node cli.js cache clean
node cli.js rm npm -g -f --loglevel error
node cli.js install -g -f
npm ERR! error installing npm#1.0.18 Error: EACCES, Permission denied '../lib/node_modules/npm/bin/npm.js'
npm ERR! Error: EACCES, Permission denied '../lib/node_modules/npm/bin/npm.js'
npm ERR!
npm ERR! Please use 'sudo' or log in as root to run this command.
npm ERR!
npm ERR! sudo npm "install" "-g" "-f"
npm ERR!
npm ERR! or set the 'unsafe-perm' config var to true.
npm ERR!
npm ERR! npm config set unsafe-perm true
npm ERR!
npm ERR! System Linux 2.6.38-10-generic
npm ERR! command "node" "/tmp/npm.1568/package/cli.js" "install" "-g" "-f"
npm ERR! cwd /tmp/npm.1568/package
npm ERR! node -v v0.4.9
npm ERR! npm -v 1.0.18
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /tmp/npm.1568/package/npm-debug.log
npm not ok
It worked
What should I do? I tried these with no success:
chown -R cirk /usr/lib/nodejs
// and also this
chown -R cirk /usr/lib/node_modules (node_modules is empty it tries to install NPM here or what)
actually it did something, as you can see it writes at the end It worked what is a big lie!
Why are you running that in /usr?
If you really need to, this page suggests you may run that as root, so that would be:
curl https://www.npmjs.com/install.sh | sudo sh
But you better make sure it won't break your system, before running that.
I screwed up the permissions on my npm installation, and had this error when reinstalling. I solved it in the crudest way: by liberally sudo rm -rfing any directory tree that gave me trouble, then recompiling node.js and reinstalling npm.
If all else fails, you could fall back to that.

Resources