Trouble installing towerjs on ubuntu - node.js

I keep getting this error when the towerjs post install script runs
npm ERR! Error: EACCES, open '/home/claire/.npm/e18f6569-thub-com-viatropos-coffeecup-git.lock'
I've tried sudo, and -g but I think it's because the post install script doesn't include sudo. I can install coffeecup on its own, but the tower sub install fails.

Login with root to finish installation correctly.
For Ubuntu:
Set root password if it not defined yet:
sudo passwd
Change user to root
su
Install tower
npm install tower -g
This way works for me.
Note: not work if you change user to root with sudo -s command. Works only with su.

Related

I cannot install nodemon by using npm command

enter image description here
When i tried to install nodemon package using npm i got errors as shown in the picture. I also tried using sudo but nothing changed.
you can use this command.
sudo npm install nodemon -g
sudo makes sure that the command would run as a superuser that allows users to run programs with the security privileges of another user (normally the superuser, or root).
-g instructs npm to install the node package globally onto the system.

npm version is different for sudo user and for regular user with sudo

can someone explain why I get the 4.2.0, please? (image)
I'm trying to have the same version for both superuser and 'regular' user.
when running:
sudo npm install -g npm
nothing changes.

fail to install electron in ubuntu

I followed the command 'npm install -g electron', the command line gives me back an error 'EACCES:permission denied, mkdir /usr/local/lib/node_modules/electron/.electron'
I tried to give permission by 'chown -R root /usr/local/lib/node_modules/*', but still doen't work?
anyone seen the problem before?
solved:
at last I found you can install it directly without root or sudo
If you are using the -g flag for global, you have to either run the command as the root user or invoke the command with sudo
sudo npm install -g electron

Fix for npm global install on Ubuntu

I have a nodejs package that requires a global install. This one fails in a way that leads me to believe there might be a configuration problem in the the Ubuntu package npm. This happens every-time I setup an Ubuntu 14.04 machine.
sudo apt-get install npm
npm install -g lineman
The npm -g command will throw some access error naming the local lib and bin directories. Unlike some global installs, it is not an option to cheat and run the second command under sudo. So, the only fix I have found that will work is something like this:
sudo chgrp -R $(whoami) /usr/local/bin /usr/local/lib
sudo chmod -R g+rwx /usr/local/bin /usr/local/lib
The fix is fine for me, I'm the only user. But is this really the best way to do it? I don't want to document my fix for anyone else that might use it in an environment where this will not work or cause trouble.
Also, should I file a bug report with someone who packages npm for Ubuntu?
Instead of npm install -g lineman, you should run sudo npm install -g lineman. npm requires permission as well.
Also check this stackoverlfow link.

MAC OS - Node.js (NPM) - Installing via AppleScript with Admin Rights

When I run the following commands one by one in Terminal it works and installs,
sudo npm install supervisor
sudo npm install forever
It asks for the admin password in Terminal window and installs fine.
In AppleScript I run this as,
tell application "Terminal"
do script "sudo npm install supervisor" in window 1
end tell
tell application "Terminal"
do script "sudo npm install forever --global" in window 1
end tell
It opens Terminal and asks the password and waits for user response to enter the password to continue. I tried the following AppleScript,
do shell script "sudo npm install supervisor" with administrator privileges
do shell script "sudo npm install forever --global" with administrator privileges
And got the following error,
error "sudo: npm: command not found" number 1
The AppleScript needs to ask for the password once in the common enter the username and password dialog and run the,
sudo npm install supervisor
sudo npm install forever
In Terminal without asking for password in Terminal window. How to do it?
https://developer.apple.com/library/mac/technotes/tn2065/_index.html
Shell scripts do not by default have your path exported into them with apple script. In addition, they are run in shell instead of your default Terminal shell (most likely bash). You should include the full path to npm (/usr/local/bin/npm for me; find using which npm) instead of just npm when trying to run an apple script.
However, when you specify the full path to npm, you run into another problem. npm can't find node in the path. The solution I found to work was to export PATH in the apple script.
export PATH=$PATH:/usr/local/bin; sudo npm install forever
Double check that /usr/local/bin contains both node and npm. This should allow you to successfully install without being prompted.

Resources