Can't Install lessc using NPM on mac - node.js

I was trying to install lessc globally on my mac, I installed node.js from their website, and when I run the command (npm install -g less) I get this, could you please help me, all I want to do is to install Less and get the less2css compiler on sublimetext 3 work properly:
npm install -g less
npm WARN locking Error: EACCES, open '/Users/Mohammad/.npm/_locks/less-c2213c903e2e7354.lock'
npm WARN locking at Error (native)
npm WARN locking /Users/Mohammad/.npm/_locks/less-c2213c903e2e7354.lock failed { [Error: EACCES, open '/Users/Mohammad/.npm/_locks/less-c2213c903e2e7354.lock']
npm WARN locking errno: -13,
npm WARN locking code: 'EACCES',
npm WARN locking path: '/Users/Mohammad/.npm/_locks/less-c2213c903e2e7354.lock' }
npm ERR! Darwin 14.4.0
npm ERR! argv "node" "/usr/local/bin/npm" "install" "-g" "less"
npm ERR! node v0.12.7
npm ERR! npm v2.11.3
npm ERR! Attempt to unlock /usr/local/lib/node_modules/less, which hasn't been locked
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! /Users/Mohammad/npm-debug.log
MacBook-Pro:~ Mohammad$ npm install -g less
npm WARN locking Error: EACCES, open '/Users/Mohammad/.npm/_locks/less-c2213c903e2e7354.lock'
npm WARN locking at Error (native)
npm WARN locking /Users/Mohammad/.npm/_locks/less-c2213c903e2e7354.lock failed { [Error: EACCES, open '/Users/Mohammad/.npm/_locks/less-c2213c903e2e7354.lock']
npm WARN locking errno: -13,
npm WARN locking code: 'EACCES',
npm WARN locking path: '/Users/Mohammad/.npm/_locks/less-c2213c903e2e7354.lock' }
npm ERR! Darwin 14.4.0
npm ERR! argv "node" "/usr/local/bin/npm" "install" "-g" "less"
npm ERR! node v0.12.7
npm ERR! npm v2.11.3
npm ERR! Attempt to unlock /usr/local/lib/node_modules/less, which hasn't been locked
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! /Users/Mohammad/npm-debug.log

You need to execute this command as superuser if you do not have write permissions on the /usr/local directory.
Please try:
sudo npm install -g less

Related

Unable to install react native due to the following errors, any idea what might be leading for this errors?

sachin#sachin-Lenovo-G50-80:~$ npm install -g react-native-cli
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/react-native-cli/node_modules/semver
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/react-native-cli
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/react-native-cli/node_modules
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
/usr/local/lib
-- react-native-cli#2.0.1
-- semver#5.6.0
npm ERR! Linux 4.15.0-34-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "-g" "react-native-cli"
npm ERR! node v8.10.0
npm ERR! npm v3.5.2
npm ERR! path /usr/local/lib/node_modules/react-native-cli/node_modules/semver
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules/react-native-cli/node_modules/semver'
npm ERR! { Error: EACCES: permission denied, access '/usr/local/lib/node_modules/react-native-cli/node_modules/semver'
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules/react-native-cli/node_modules/semver' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Please include the following file with any support request:
npm ERR! /home/sachin/npm-debug.log
When you want to install some node package globally, you need admin permission so do it as follows:
$sudo npm install -g react-native-cli
And write your password when asking.
You don't have write access in /usr/local/lib/.
This link might help.

install "npm install -g ionic#latest cordova" but I get errors

When I run the below command in cordova,
npm install -g ionic#latest cordova
I get the following errors -
npm WARN optional Skipping failed optional dependency /ionic/chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents#1.1.2
npm ERR! Linux 4.4.0-43-Microsoft
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "ionic#latest" "cordova"
npm ERR! node v4.2.6
npm ERR! npm v3.5.2
npm ERR! path /usr/local/lib/node_modules/cordova/node_modules/npm/node_modules/dezalgo
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules/cordova/node_modules/npm/
node_modules/dezalgo'
npm ERR! at Error (native)
npm ERR! { [Error: EACCES: permission denied, access '/usr/local/lib/node_modules/cordova/node_modules/
npm/node_modules/dezalgo']
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules/cordova/node_modules/npm/node_modules/dezalgo' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Please include the following file with any support request:
npm ERR! /home/oj1125/npm-debug.log
Can anyone help me with these errors?

npm install ghost fails with code EPERM errno -4048 syscall rename (on Windows)

During the install of Ghost with npm version 3.8.x, the following errors occur:
npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents#1.0.8
npm WARN Gonzah#0.0.1 No repository field.
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\aosman\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "ghost"
npm ERR! node v4.3.2
npm ERR! npm v3.8.1
npm ERR! path D:\elastc-app\node_modules\ghost
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall rename
npm ERR! Error: EPERM: operation not permitted, rename 'D:\elastc-app\node_modules\ghost' -> 'D:\elastc-app\node_modules\.ghost.DELETE'
npm ERR! at moveAway (C:\Users\aosman\AppData\Roaming\npm\node_modules\npm\lib\install\action\finalize.js:38:5)
npm ERR! at destStatted (C:\Users\aosman\AppData\Roaming\npm\node_modules\npm\lib\install\action\finalize.js:27:7)
npm ERR! at FSReqWrap.oncomplete (fs.js:82:15)
npm ERR!
npm ERR! Error: EPERM: operation not permitted, rename 'D:\elastc-app\node_modules\ghost' -> 'D:\elastc-app\node_modules\.ghost.DELETE'
npm ERR! at Error (native)
npm ERR! { [Error: EPERM: operation not permitted, rename 'D:\elastc-app\node_modules\ghost' -> 'D:\elastc-app\node_modules\.ghost.DELETE'] parent: 'Gonzah' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Please include the following file with any support request:
npm ERR! D:\elastc-app\npm-debug.log
After searching for a day to figure this out, it's apparently tied to a known bug in npm v3.8 (https://github.com/npm/npm/issues/10379#issuecomment-163316532).
The solution is to temporarily downgrade npm to v2 to perform the install. Do this:
npm uninstall npm -g
npm install npm#2 -g
npm install ghost
Then of course feel free to update npm to the latest version again.

Installing express in Terminal on Mac

I get this code. I am on a Mac. I have installed npm. I am an Admin. What am I doing wrong? I've been googling for hours.
Matts-MacBook-Pro-3:Start Matt$ npm install express-generator -g
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/express-generator
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
/usr/local/lib
└── express-generator#4.13.1
npm ERR! Darwin 14.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "express-generator" "-g"
npm ERR! node v5.3.0
npm ERR! npm v3.3.12
npm ERR! path /usr/local/lib/node_modules/express-generator
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules/express-generator'
npm ERR! at Error (native)
npm ERR! { [Error: EACCES: permission denied, access '/usr/local/lib/node_modules/express-generator']
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules/express-generator' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/Matt/Start/Start/npm-debug.log
Matts-MacBook-Pro-3:Start Matt$
Try clearing the npm cache and try the npm install again. You can use the following to clear the npm cache.
npm cache clean <path to express-generator>
Sometimes you get this error even when you are on ssh, the npm registry might be configured to use a different registry for npm packages and that registry might not have a express-generator

npm install -g webpack gives tar.unpack untar error

I created a new user on my Mac and tried this. This normally works in my other account. This new user is an administrator also.
npm ERR! tar.unpack untar error /Users/test/.npm/webpack/1.11.0/package.tgz
npm ERR! Darwin 14.4.0
npm ERR! argv "node" "/usr/local/bin/npm" "install" "-g" "webpack"
npm ERR! node v0.12.4
npm ERR! npm v2.10.1
npm ERR! path /usr/local/lib/node_modules/webpack
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! Error: EACCES, mkdir '/usr/local/lib/node_modules/webpack'
npm ERR! at Error (native)
npm ERR! { [Error: EACCES, mkdir '/usr/local/lib/node_modules/webpack']
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! path: '/usr/local/lib/node_modules/webpack',
npm ERR! fstream_type: 'Directory',
npm ERR! fstream_path: '/usr/local/lib/node_modules/webpack',
npm ERR! fstream_class: 'DirWriter',
npm ERR! fstream_stack:
npm ERR! [ '/usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:35:25',
npm ERR! '/usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:47:53',
npm ERR! 'FSReqWrap.oncomplete (fs.js:95:15)' ] }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/test/WebstormProjects/babel-test/npm-debug.log
I am not very good with the UNIX stuff and things, I just wish these things would be more easy.
From the looks of it, since it says EACCES, it is probably getting an access denied from the system. If you are installing globally on unix you must use sudo.
$ sudo npm install -g webpack
Start using nvm and it will save you from using sudo at all.
https://github.com/creationix/nvm

Resources