how do you globally install a file as the root/administrator? - javascript

when I try "npm install -g jshint", I get the following readout.
user-MacBook-Pro:~ davidgoldberg$ npm install -g jshint
npm ERR! Error: EACCES, mkdir '/usr/local/lib/node_modules/jshint'
npm ERR! { [Error: EACCES, mkdir '/usr/local/lib/node_modules/jshint']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/usr/local/lib/node_modules/jshint',
npm ERR! fstream_type: 'Directory',
npm ERR! fstream_path: '/usr/local/lib/node_modules/jshint',
npm ERR! fstream_class: 'DirWriter',
npm ERR! fstream_stack:
npm ERR! [ '/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:46:53',
npm ERR! 'Object.oncomplete (fs.js:107:15)' ] }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Darwin 13.3.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "jshint"
npm ERR! cwd /Users/davidgoldberg
npm ERR! node -v v0.10.32
npm ERR! npm -v 1.4.28
npm ERR! path /usr/local/lib/node_modules/jshint
npm ERR! fstream_path /usr/local/lib/node_modules/jshint
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/jshint'
npm ERR! fstream_stack /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:46:53
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/davidgoldberg/npm-debug.log
npm ERR! not ok code 0
I'd love to get error sorted out. "npm install jshint" works fine, by the way. ultimately, I need help downloading jshint for use in "sublimelint-jshint" on sublime tex 3.

You've got to be root to install globally with npm, so try:
sudo npm -g install jshint

Related

Can't install #customrealms/cli: Error: Illegal characters in path

I tried to install crx command using:
npm i -g #customrealms/cli
I got the following error message:
npm ERR! code 1
npm ERR! path C:\Users\____\AppData\Roaming\npm\node_modules\#customrealms\cli
npm ERR! command failed
npm ERR! command C:\windows\system32\cmd.exe /d /s /c node postinstall.js install
npm ERR! Copying the relevant binary for your platform win32 (x64)
npm ERR! Error: Command failed: npm bin -g
npm ERR!
npm ERR! at ChildProcess.exithandler (node:child_process:419:12)
npm ERR! at ChildProcess.emit (node:events:513:28)
npm ERR! at maybeClose (node:internal/child_process:1091:16)
npm ERR! at Socket.<anonymous> (node:internal/child_process:449:11)
npm ERR! at Socket.emit (node:events:513:28)
npm ERR! at Pipe.<anonymous> (node:net:322:12) {
npm ERR! code: 1,
npm ERR! killed: false,
npm ERR! signal: null,
npm ERR! cmd: 'npm bin -g'
npm ERR! }
npm ERR! C:\Users\____\AppData\Roaming\npm\node_modules\#customrealms\cli\node_modules\mkdirp\lib\path-arg.js:20
npm ERR! throw Object.assign(new Error('Illegal characters in path.'), {
npm ERR! ^
npm ERR!
npm ERR! Error: Illegal characters in path.
npm ERR! at pathArg (C:\Users\____\AppData\Roaming\npm\node_modules\#customrealms\cli\node_modules\mkdirp\lib\path-arg.js:20:27)
npm ERR! at mkdirp (C:\Users\____\AppData\Roaming\npm\node_modules\#customrealms\cli\node_modules\mkdirp\index.js:10:10)
npm ERR! at getInstallationPath (C:\Users\____\AppData\Roaming\npm\node_modules\#customrealms\cli\postinstall.js:45:11)
npm ERR! at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
npm ERR! at async verifyAndPlaceBinary (C:\Users\____\AppData\Roaming\npm\node_modules\#customrealms\cli\postinstall.js:53:30)
npm ERR! at async Object.install (C:\Users\____\AppData\Roaming\npm\node_modules\#customrealms\cli\postinstall.js:157:5) {
npm ERR! path: 'C:\\Users\\____\\AppData\\Roaming\\npm\\node_modules\\#customrealms\\cli\\Unknown command: "bin"\n' +
npm ERR! '\n' +
npm ERR! 'To see a list of supported npm commands, run:\n' +
npm ERR! ' npm help',
npm ERR! code: 'EINVAL'
npm ERR! }
npm ERR!
npm ERR! Node.js v18.14.1
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\____\AppData\Local\npm-cache\_logs\2023-02-17T11_15_07_001Z-debug-0.log
I wanted to make a minecraft plugin using customrealms
I have a 64 bit windows 11, and I that's what I tried to install: https://github.com/customrealms/cli

node inspector installation error

While installing node inspector I am getting this error -
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\
node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "node-inspector"
npm ERR! node v6.9.1
npm ERR! npm v3.10.8
npm ERR! code ELIFECYCLE
npm ERR! v8-debug#0.7.7 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the v8-debug#0.7.7 install script 'node-pre-gyp install --fal
lback-to-build'.
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 v8-debug package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-pre-gyp install --fallback-to-build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs v8-debug
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls v8-debug
npm ERR! There is likely additional logging output above.
What could be the issue?

Error message installing npm

I get the following message when I type npm install from the root directory
$ npm install
npm ERR! install Couldn't read dependencies
npm ERR! Darwin 15.3.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v4.4.0
npm ERR! npm v2.14.20
npm ERR! path /package.json
npm ERR! code ENOPACKAGEJSON
npm ERR! errno -2
npm ERR! syscall open
npm ERR! package.json ENOENT: no such file or directory, open '/package.json'
npm ERR! package.json This is most likely not a problem with npm itself.
npm ERR! package.json npm can't find a package.json file in your current directory.
npm ERR! Darwin 15.3.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v4.4.0
npm ERR! npm v2.14.20
npm ERR! path npm-debug.log.3965331654
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall open
npm ERR! Error: EACCES: permission denied, open 'npm-debug.log.3965331654'
npm ERR! at Error (native)
npm ERR! { [Error: EACCES: permission denied, open 'npm-debug.log.3965331654']
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'open',
npm ERR! path: 'npm-debug.log.3965331654' }
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! /npm-debug.
Probably you are trying to run this code in empty directory. This is not right. npm install command installs all packages and dependencies which are listed in package.json file.
If you want to start npm project and make npm install run successfully, first run npm init command. This will create you package.json and there you will be able to enter all the packages and deps. Then you will be able to run npm install
Here is a tutorial
And one more

NPM no longer working

so I wasn't paying attention and ran this command-
npm install npm install jasmine-node -g
which caused this -
npm http GET https://registry.npmjs.org/install
npm http GET https://registry.npmjs.org/jasmine-node
npm http GET https://registry.npmjs.org/npm
npm http 200 https://registry.npmjs.org/install
npm http GET https://registry.npmjs.org/install/-/install-0.1.7.tgz
npm http 200 https://registry.npmjs.org/install/-/install-0.1.7.tgz
npm http 200 https://registry.npmjs.org/jasmine-node
npm http GET https://registry.npmjs.org/jasmine-node/-/jasmine-node-1.4.0.tgz
npm http 200 https://registry.npmjs.org/jasmine-node/-/jasmine-node-1.4.0.tgz
npm http 200 https://registry.npmjs.org/npm
npm http GET https://registry.npmjs.org/npm/-/npm-1.2.15.tgz
npm http 200 https://registry.npmjs.org/npm/-/npm-1.2.15.tgz
npm ERR! Error: EACCES, mkdir '/usr/local/lib/node_modules/install'
npm ERR! { [Error: EACCES, mkdir '/usr/local/lib/node_modules/install']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/usr/local/lib/node_modules/install',
npm ERR! fstream_type: 'Directory',
npm ERR! fstream_path: '/usr/local/lib/node_modules/install',
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 12.0.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "npm" "install" "jasmine-node" "-g"
npm ERR! cwd /Users/psanker/Google Drive/Coding/Javascript/WhatsGoingOn
npm ERR! node -v v0.8.17
npm ERR! npm -v 1.2.0
npm ERR! path /usr/local/lib/node_modules/install
npm ERR! fstream_path /usr/local/lib/node_modules/install
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/install'
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! 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 12.0.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "npm" "install" "jasmine-node" "-g"
npm ERR! cwd /Users/psanker/Google Drive/Coding/Javascript/WhatsGoingOn
npm ERR! node -v v0.8.17
npm ERR! npm -v 1.2.0
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! error rolling back Error: EACCES, unlink '/usr/local/lib/node_modules/npm'
npm ERR! error rolling back npm#1.2.15 { [Error: EACCES, unlink '/usr/local/lib/node_modules/npm']
npm ERR! error rolling back errno: 3,
npm ERR! error rolling back code: 'EACCES',
npm ERR! error rolling back path: '/usr/local/lib/node_modules/npm' }
npm ERR! Error: EACCES, unlink '/usr/local/lib/node_modules/npm'
npm ERR! { [Error: EACCES, unlink '/usr/local/lib/node_modules/npm']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/usr/local/lib/node_modules/npm' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Darwin 12.0.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "npm" "install" "jasmine-node" "-g"
npm ERR! cwd /Users/psanker/Google Drive/Coding/Javascript/WhatsGoingOn
npm ERR! node -v v0.8.17
npm ERR! npm -v 1.2.0
npm ERR! path /usr/local/lib/node_modules/npm
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, unlink '/usr/local/lib/node_modules/npm'
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/psanker/Google Drive/Coding/Javascript/WhatsGoingOn/npm-debug.log
npm ERR! not ok code 0
Now when I try and run
npm install jasmine-node -g
I get
-bash: /usr/local/bin/npm: No such file or directory
What's going on?
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/
** Update **
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 globally:
sudo chown -R `whoami` ~/.npm
Tried it myself.
You will need to install npm again. If you use git, this is the easiest way:
git clone http://github.com/isaacs/npm.git
cd npm
sudo make install
Otherwise, there is an install script too:
curl http://npmjs.org/install.sh | sh
(possibly you will need to use sudo sh instead of sh).
Then install your module again:
sudo npm install jasmine-node -g
EDIT 23/01/2014:
Now npm comes with NodeJs itself, so just reinstall NodeJs.
Look at the error
Please try running this command again as root/Administrator.
You need to run this with sudo
$ sudo npm install jasmine-node -g
This worked for me (OSX). I had to run it in my user directory.
cd ~
curl -L http://npmjs.org/install.sh | sudo sh
I was able to get around the permissions issues by setting my packages to install locally with a one-line "$HOME/.npmrc" file:
prefix=${HOME}/.npm_packages

Installing grunt globally failed and I can't find it on npmjs.org

I'm getting this error when I run npm install - ideas on why this might be happening?
I've never had a problem installing other libraries globally and I can't find grunt on http://search.npmjs.org/
npm install -g grunt
npm ERR! Error: Not found: grunt#''
npm ERR! Valid install targets:
npm ERR! ["latest","devel"]
npm ERR! at installTargetsError (/usr/local/lib/node_modules/npm/lib/cache.js:410:10)
npm ERR! at /usr/local/lib/node_modules/npm/lib/cache.js:403:17
npm ERR! at saved (/usr/local/lib/node_modules/npm/lib/utils/npm-registry-client/get.js:136:7)
npm ERR! at cb (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:36:9)
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 10.8.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "grunt"
npm ERR! cwd /Users/**
npm ERR! node -v v0.4.10
npm ERR! npm -v 1.0.103
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/**/npm-debug.log
npm not ok
I ended up just having to upgrade node and npm

Categories

Resources