Closed leabdalla closed 10 years ago
I see the same error currently. But for now it seems that the problem is with the package "usage@0.3.9" hope to find a fix soon.
PM2 Has been using the same (current) version of that package for a while, so I don't think that's the problem. The error message to me looks like you might not have node-gyp installed correctly.
How did you install node on Ubuntu? Did you follow the instructions Node.js provides for Ubuntu?
Specifically, make sure you have python, g++, and make installed:
sudo apt-get install -y python-software-properties python g++ make
If you installed node from apt-get, make sure you didn't install it from the outdated default repository. If you didn't install via apt-get, you may also need to install node-gyp itself.
Using Node on Ubuntu with NVM works ok now. I have tested this with Python 2.7. Here are two ways to run this:
node
)adduser node
su node
NVM: INSTALL VIA https://github.com/creationix/nvm NVM: INSTALL NODE VERSION
npm install -g pm2
root
userInstalled NVM as root
and installed node version is v0.10.22.
If you are running with the root
user, one fix is to install pm2 into a directory and move it to the global repo:
cd ~/
npm install pm2
mv node_modules/pm2 ~/.nvm/v0.10.22/node_modules/pm2
ln -s ~/.nvm/v0.10.22/node_modules/pm2/bin/pm2 ~/.nvm/v0.10.22/bin/pm2
@cspiegl it doesn't sound like there is a "fix" here besides you need to be running the right version of node and have node-gyp and its dependencies installed. That's why I was asking what process you used to install node. If you followed the instructions I linked to on nodejs.org, it should install fine without nvm (I install from scratch on Ubuntu fairly regularly without problem).
The problem I found mainly was that I installed from scratch on node and wanted to run as root on my development machine. And that did not work if I used npm install pm2 -g
. Than I did the above steps and both worked.
@cspiegl Interesting. I just tried npm install pm2 -g
as root and it succeeded, and I can run pm2 as root just fine.
If you're solution works for you, I guess that's what matters. This doesn't sound like a common use case to me, anyway.
I found it weird that it did not work. But now it works. I am happy. But I plan on using a node user anyways. So that problem will likely never arise again for me.
Just hope this helps someone someday ;-).
thanks for explanations
This isn't fixed. Still a problem for me! Neither "fix" fixes this.
Got the same under latest ubuntu, with latest node, npm and node-gyp
> usage@0.3.9 install /usr/local/lib/node_modules/pm2/node_modules/usage
> node-gyp rebuild
gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/0.10.26"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/pm2/node_modules/usage/.node-gyp"
gyp http GET http://nodejs.org/dist/v0.10.26/node-v0.10.26.tar.gz
gyp http 200 http://nodejs.org/dist/v0.10.26/node-v0.10.26.tar.gz
Traceback (most recent call last):
File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py", line 18, in <module>
sys.exit(gyp.script_main())
AttributeError: 'module' object has no attribute 'script_main'
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:337:16)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Linux 3.11.0-18-generic
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/pm2/node_modules/usage
gyp ERR! node -v v0.10.26
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok
npm http 304 https://registry.npmjs.org/configurable/0.0.1
npm http 304 https://registry.npmjs.org/charm
npm http 304 https://registry.npmjs.org/escape-regexp/0.0.1
npm http 304 https://registry.npmjs.org/keypress
npm http 304 https://registry.npmjs.org/mkdirp
npm ERR! usage@0.3.9 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the usage@0.3.9 install script.
npm ERR! This is most likely a problem with the usage package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls usage
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.11.0-18-generic
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "pm2"
npm ERR! cwd /home/fragger
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/fragger/npm-debug.log
npm ERR! not ok code 0
Ran into this same problem on a new digital ocean droplet (Ubuntu 13.10 x64). Fixed it by switching to node v0.10.24 to do the install. So far (fingers crossed) switching back to v0.10.26 after installing seems to work.
Same here. I can't install pm2 on DigitalOcean 14.04 x64 and it also doesn't work on my 13.10 dev machine. I installed node using nvm and I want to keep it that way.
Thanks to a workaround posted in node-gyp #363, I was able to resolve this issue when installing pm2 on CentOS 6.5 with python 2.6.6 already installed.
My basic steps:
# install node and npm ...
rm -rf $(dirname `python -c 'import gyp; print gyp.__file__'`)
npm install -g node-gyp
npm install -g pm2
! solution for mac go to ~/.npm dir and remove all pm2 packages (about 4 units)
@gen4sp :+1:
npm cache clear -f
does exactly this
using: npm cache clear -f
and npm install pm2 -g --unsafe-perm
worked for me.
Same here. Using Ubuntu 14.04.1. I had the errors below. The commands given above solved the problem:
npm cache clear -f
npm install pm2 -g --unsafe-perm
The errors were
pedro@clima:~$ sudo npm install -g pm2
/
> pm2@0.11.1 preinstall /usr/lib/node_modules/pm2
> bash ./scripts/preinstall.sh
##### PM2 INSTALLATION
#
#
# As you run PM2 as root, to update PM2 automatically
# you must add the --unsafe-perm flag.
#
# $ npm install pm2 -g --unsafe-perm
#
# Else run the installation as a non root user
#
#
#
######
npm ERR! pm2@0.11.1 preinstall: `bash ./scripts/preinstall.sh`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the pm2@0.11.1 preinstall script.
npm ERR! This is most likely a problem with the pm2 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! bash ./scripts/preinstall.sh
npm ERR! You can get their info via:
npm ERR! npm owner ls pm2
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.13.0-32-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "-g" "pm2"
npm ERR! cwd /home/pedro/node
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR! not ok code 0
I just install at digital ocean droplet with ubuntu 14.04 node v0.10.25 and 1.3.10 but when i type pm2 start server.js. the console just close the command. like nothing happen. anyone have a solution?
in OSX install runs fine, but not in DigitalOcean Ubuntu via ssh (as root)