CoffeeScript Installing with NPM and Node [duplicate] - node.js

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
error installing coffeescript on mac 10.7.2
At the moment, I am trying to install CoffeeScript on my computer. I have node.js version 0.6.7 and npm 1.1.0-beta-10. When i run the command npm install -g coffee-script, it shows this error.
npm http GET https://registry.npmjs.org/coffee-script
npm http 200 https://registry.npmjs.org/coffee-script
npm http GET https://registry.npmjs.org/coffee-script/-/coffee-script-1.2.0.tgz
npm http 200 https://registry.npmjs.org/coffee-script/-/coffee-script-1.2.0.tgz
npm ERR! Could not create /usr/local/lib/node_modules/___coffee-script.npm
npm ERR! error installing coffee-script#1.2.0
npm ERR! Error: EACCES, permission denied '/usr/local/lib/node_modules/___coffee-script.npm'
npm ERR! Report this *entire* log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-#googlegroups.com>
npm ERR!
npm ERR! System Darwin 11.0.1
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "coffee-script"
npm ERR! cwd /Users/Solomon
npm ERR! node -v v0.6.7
npm ERR! npm -v 1.1.0-beta-10
npm ERR! path /usr/local/lib/node_modules/___coffee-script.npm
npm ERR! code EACCES
npm ERR! message EACCES, permission denied '/usr/local/lib/node_modules/___coffee-script.npm'
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/Solomon/npm-debug.log
How do I fix this?

Error: EACCES, permission denied '/usr/local/lib/node_modules/___coffee-script.npm'
That means you dont have access, so run as root
$ sudo npm install -g coffee-script
(Bonus points for alternatively, not using coffeescript (it's a horrible thing))

The permission denied part is your hint that the installer needs privileges that it doesn't have. Try running as root, i.e.
sudo npm install coffee-script

Related

Trying to install npm on Raspberry Pi Error

I am working on a simple smart mirror project with javascript and electron. I was able to get the software working on my laptop but when I moved it to the raspberry pi I am having issues installing npm. After entering "npm install" I get this:
npm WARN package.json bcrypt-pbkdf#1.0.1 No repository field.
npm ERR! 404 Not Found
npm ERR! 404
npm ERR! 404 'types/jquery' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it
npm ERR! 404 It was specified as a dependency of 'smart-mirror-server'
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, or http url, or git url.
npm ERR! System Linux 4.9.24-v7+
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! cwd /home/pi/Desktop/smart-connected-mirror-master
npm ERR! node -v v0.10.29
npm ERR! npm -v 1.4.21
npm ERR! code E404
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/pi/Desktop/smart-connected-mirror-master/npm-debug.log
npm ERR! not ok code 0
I have tried
sudo apt-get update
as well as
sudo apt-get upgrade
Any ideas what to do? Thanks!
EDIT:
I updated the node.js to a more current version and now it installed without error. However, when I typed in the command
npm start
I get this:
sh: 1: electron: Permission denied
npm ERR! Linux 4.9.24-v7+
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "start"
npm ERR! node v7.10.0
npm ERR! npm v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! smart-mirror-server#1.0.0 start: `electron .`
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the smart-mirror-server#1.0.0 start script 'electron .'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the smart-mirror- server package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! electron .
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs smart-mirror-server
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls smart-mirror-server
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/pi/.npm/_logs/2017-05-29T03_33_22_466Z-debug.log
Have you seen this issue? Electron works only on RaspberryPi 2/3 what version are you using?
Also have you run npm install before actually run the app? Sometimes when copying node_modules from OS to OS the executable permissions get very confused.
You can try a fresh install with: rm -rf node_modules && npm install

I can't update electron with npm

I cannot update electron-prebuilt.
I executed sudo npm update electron-prebuilt -g many times.
But, The Permission denied Error occur every time in spite of using sudo.
Why I can't update electron successfully?
iojs3.2.0, OS X 10.10.5
The following is error log.
/usr/local/lib/node_modules/electron-prebuilt/install.js:15
throw err
^
Error: EACCES: permission denied, rename '/usr/local/lib/node_modules/electron-prebuilt/electron-tmp-download-818-1441021602097/electron-v0.31.1-darwin-x64.zip' -> '/Users/user_name/.electron/electron-v0.31.1-darwin-x64.zip'
at Error (native)
npm ERR! Darwin 14.5.0
npm ERR! argv "/usr/local/bin/iojs" "/usr/local/bin/npm" "install" "electron-prebuilt" "-g"
npm ERR! node v3.2.0
npm ERR! npm v2.14.1
npm ERR! code ELIFECYCLE
npm ERR! electron-prebuilt#0.31.1 postinstall: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the electron-prebuilt#0.31.1 postinstall script 'node install.js'.
npm ERR! This is most likely a problem with the electron-prebuilt package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node install.js
npm ERR! You can get their info via:
npm ERR! npm owner ls electron-prebuilt
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /usr/local/lib/node_modules/npm-debug.log
The issue is reported at https://github.com/mafintosh/electron-prebuilt/issues/48 and a workaround seems to be to first install without the -g flag which will get the file into user folder first, and then install again with -g.
EDIT: I guess somehow the permissions are messed up and I'm doing chmod. It seems that if I chmod not only for the user myself but also for group and others it works. Maybe others could also give it a try?
I had the same problem in OS X. I fixed it deleting the ~/.electron folder

Installing gulp with npm

i am trying to install gulp via npm on DigitalOcean droplet with following command (with and without sudo):
npm install -g gulp
and im getting errors i cant figure out:
> v8flags#1.0.5 install /root/local/lib/node_modules/gulp/node_modules/v8flags
> node fetch.js
sh: 1: node: Permission denied
npm ERR! Linux 3.13.0-24-generic
npm ERR! argv "node" "/root/local/bin/npm" "install" "-g" "gulp"
npm ERR! node v0.10.33
npm ERR! npm v2.1.11
npm ERR! code ELIFECYCLE
npm ERR! v8flags#1.0.5 install: `node fetch.js`
npm ERR! Exit status 127
npm ERR!
npm ERR! Failed at the v8flags#1.0.5 install script 'node fetch.js'.
npm ERR! This is most likely a problem with the v8flags package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node fetch.js
npm ERR! You can get their info via:
npm ERR! npm owner ls v8flags
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /root/local/bin/npm-debug.log
The node install is made according to this guide.
I had the same issue, installing an earlier version of gulp worked for me:
sudo npm install -g gulp#3.8.8
Found this here: http://forum.ionicframework.com/t/osx-error-v8flags-after-npm-update-ionic/13905/5
Also tried a bunch of other solutions involving solutions as mentioned here:
NPM cannot install dependencies - Attempt to unlock something which hasn't been locked
None of that worked for me.
The error I was getting was this:
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
/
node.js:815
var cwd = process.cwd();
^
Error: EACCES, permission denied
at Function.startup.resolveArgv0 (node.js:815:23)
at startup (node.js:58:13)
at node.js:906:3

"sudo npm install -g grunt-cli" gives me an error

I get an error when trying to install gruntjs on a linux 12.04 (with a mirrored packages source)
Here is the error:
sudo npm install -g grunt-cli
npm ERR! Error: ENOENT, open '/home/havetl/.npm/d63f3d0b-grunt-cli.lock'
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-#googlegroups.com>
npm ERR! System Linux 3.5.0-23-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "-g" "grunt-cli"
npm ERR! cwd /home/havetl
npm ERR! node -v v0.10.18
npm ERR! npm -v 1.3.8
npm ERR! path /home/havetl/.npm/d63f3d0b-grunt-cli.lock
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! Error: EACCES, open 'npm-debug.log'
npm ERR! { [Error: EACCES, open 'npm-debug.log'] errno: 3, code: 'EACCES', path: 'npm-debug.log' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Linux 3.5.0-23-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "-g" "grunt-cli"
npm ERR! cwd /home/havetl
npm ERR! node -v v0.10.18
npm ERR! npm -v 1.3.8
npm ERR! path npm-debug.log
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, open 'npm-debug.log'
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/havetl/npm-debug.log
npm ERR! not ok code 0
Thanks for any idea!
According to the maintainer of npm, installing packages with sudo is considered bad practice because you are allowing that package to have complete control of your system and you can't and SHOULDN'T trust these packages with root access. Think Debian's long release cycles as an extreme example of protecting end users from community maintained packages for this exact reason.
http://howtonode.org/introduction-to-npm
You should do what Issaacs suggests and chown your /usr/local folder so you have RW permissions.
I've had this problem before; sometimes for global packages your current working directory has to be ~/ (but I'm not sure why this is!). Try:
cd ~/; sudo npm install -g grunt-cli
This blog worked for me :
http://slopjong.de/2012/10/31/how-to-install-the-latest-nodejs-in-ubuntu/
the error was because in ubuntu v12 few of the dependencies were not available for the latest version of Node.

npm coffescript install error

I keep having errors when trying to install coffeescript.
node version v0.6.1
npm version 1.0.106
npm ERR! Could not create /usr/local/lib/node_modules/___coffee-script.npm
npm ERR! error installing coffee-script#1.1.3 Error: EACCES, permission denied '/usr/local/lib/node_modules/___coffee-script.npm'
npm ERR! Error: EACCES, permission denied '/usr/local/lib/node_modules/___coffee-script.npm'
npm ERR! Report this *entire* log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-#googlegroups.com>
npm ERR!
npm ERR! System Darwin 11.2.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "coffee-script"
npm ERR! cwd /Users/Thomas
npm ERR! node -v v0.6.1
npm ERR! npm -v 1.0.106
npm ERR! path /usr/local/lib/node_modules/___coffee-script.npm
npm ERR! code EACCES
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/Thomas/npm-debug.log
npm not ok
The permission is denied and I have found that you should not sudo.
Please help and thanks in advance.
OKay all solved with the help of sudo but if anyone has any idea how to change my /usr/local/lib permissions it would be appriciated
What I do is:
sudo chown -R $USER /usr/local
That way, you can install whatever you want in /usr/local without sudoing :)

Resources