How can i install yeoman command line tool on ubuntu 20.04.1 LTS? - asp.net-core

I tried installing yeoman command line tool in Ubuntu 20.04.1 LTS for ASP.NET Core web application development. After typing
npm install -g yo in terminal, i got an error.
Description of error is provided below.
npm WARN deprecated har-validator#5.1.5: this library is no longer supported
npm WARN deprecated cross-spawn-async#2.2.5: cross-spawn no longer requires a build toolchain, use it instead
npm WARN deprecated resolve-url#0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated urix#0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN checkPermissions Missing write access to /usr/local/lib
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib'
npm ERR! { [Error: EACCES: permission denied, access '/usr/local/lib']
npm ERR! stack:
npm ERR! 'Error: EACCES: permission denied, access \'/usr/local/lib\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/shashankshekhar/.npm/_logs/2020-12-21T11_02_14_859Z-debug.log```

The issue of EACCES errors on global module installation is so common that npm has an entire web page dedicated to solving just this issue.
Since you are installing yeoman, I imagine this is a development machine. In that case, your best bet is likely to install node/npm with a package manager like nvm.
One thing you don't want to do but that people will often suggest is running the npm command with sudo. People recommend this because it's easy. But if you do that, all the lifecycle scripts (e.g., postinstall) of the dependencies of whatever you are installing will also be run as root. That's potentially a lot of untrusted code running as root.

Related

Vue - The Cli gives an error on installing

I just installed Ubuntu and tried to install the vue cli but got this error
here's the error
npm WARN deprecated subscriptions-transport-ws#0.11.0: The `subscriptions-transport-ws` package is no longer maintained. We recommend you use `graphql-ws` instead. For help migrating Apollo software to `graphql-ws`, see https://www.apollographql.com/docs/apollo-server/data/subscriptions/#switching-from-subscriptions-transport-ws For general help using `graphql-ws`, see https://github.com/enisdenjo/graphql-ws/blob/master/README.md
npm WARN deprecated source-map-resolve#0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated resolve-url#0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated urix#0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated source-map-url#0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm WARN checkPermissions Missing write access to /usr/lib/node_modules
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/lib/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/lib/node_modules'
npm ERR! [Error: EACCES: permission denied, access '/usr/lib/node_modules'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/lib/node_modules'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/m/.npm/_logs/2022-08-17T06_58_04_490Z-debug.log
I tried installing other npm packages and it worked, the cli is the only one that doesn't work
Most probably it has to do with the user rights. Here's an article on npm addressing your problem.
Boils down to two things you can try:
Reinstall npm with a node version manager
Manually change npm's default directory
I had this issue many times in the past and tried various solutions. Some of them didn't do much more than f*cking my setup even more, that's why it's really worthy to follow the official path.

Getting No such file or directory: 'ganache-cli' error

I installed ganache-cli using npm install -g ganache-cli, however I am running into a No such file or directory: 'ganache-cli error when trying to run it. When calling echo $PATH, I see ~/.npm-global/bin, which contains the ganache-cli file, so I am confused as to what the issue could be. Any help is greatly appreciated.
For reference, I am using zsh on MacOS.
ganache-cli is now deprecated. You might see the following npm-warning:
npm WARN deprecated ganache-cli#6.12.2: ganache-cli is now ganache; visit https://trfl.io/g7 for details
Use npm install -g ganache.
Use sudo npm install -g ganache if you get some error like this:
$ npm install -g ganache
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! [Error: EACCES: permission denied, access '/usr/local/lib/node_modules'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/ubuntu/.npm/_logs/2022-06-23T12_37_16_476Z-debug.log

Missing write access when installing Vue CLI

For some reason I cannot run the vue cli and trying to reinstall using:
npm install -g #vue/cli
I get a string of
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/#vue/cli/node_modules/#apollographql/graphql-playground-html
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/#vue/cli/node_modules/#babel/core/node_modules/semver
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/#vue/cli/node_modules/#babel/helper-plugin-utils
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/#vue/cli/node_modules/#babel/parser
And then ending with
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules/#vue/cli/node_modules/#apollographql/graphql-playground-html
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules/#vue/cli/node_modules/#apollographql/graphql-playground-html'
npm ERR! { Error: EACCES: permission denied, access '/usr/local/lib/node_modules/#vue/cli/node_modules/#apollographql/graphql-playground-html'
npm ERR! stack: 'Error: EACCES: permission denied, access \'/usr/local/lib/node_modules/#vue/cli/node_modules/#apollographql/graphql-playground-html\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules/#vue/cli/node_modules/#apollographql/graphql-playground-html' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
I have tried changing the permissions of /usr/local/lib/node_modules and then changed the group to "staff" (which is the same as Python also in /lib. I don't think I can uninstall node without some serious problems everywhere I use that. Stuck and not sure how to install or get vue cli running.
I have just had the same issue, but solved it by adding "sudo" before it.
So, the new line would instead look like;
sudo npm install -g #vue/cli

Error when installing the express application generator

I recently installed node and express with the help of the mozilla tutorial. I am on the next step of installing the application generator, but when I run
npm install express-generator -g
in my terminal: I recieve the following errors:
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! { Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! stack: 'Error: EACCES: permission denied, access \'/usr/local/lib/node_modules\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/adamgusky/.npm/_logs/2018-02-17T20_26_53_688Z-debug.log
I've been googling this topic for an hour now and I am very new to using the terminal for web applications (this is for a school project), so any help is appreciated.
I had a similar issue. The problem is that you aren't an administrator so you can't write to that folder. However it's considered a BAD IDEA to run sudo npm install. So what you need to do is to change the default install folder for npm global installation to one where you do have write permission.
See npm's documentation: https://docs.npmjs.com/getting-started/fixing-npm-permissions.
And also see this useful article on github: https://github.com/nodeschool/discussions/wiki/Installing-global-node-modules-(Linux-and-Mac)

Error installing Dalek JS Module - Chrome Browser

I'm having trouble installing the Chrome Browser Dalek JS Module.
Here's an extract from the console output:
npm http 304 https://registry.npmjs.org/abbrev
> dalek-browser-chrome#0.0.2 install /Users/xxx/Sites/tests/node_modules/dalek-browser-chrome
> node install.js
Chromedriver installation failed Error: EACCES, permission denied '/Users/xxx/tmp/chromedriver'
at Object.fs.unlinkSync (fs.js:582:18)
at rimrafSync (/Users/xxx/Sites/tests/node_modules/dalek-browser-chrome/node_modules/rimraf/rimraf.js:154:8)
at Promise._successFn (/Users/xxx/Sites/tests/node_modules/dalek-browser-chrome/install.js:176:7)
at Promise._withInput (/Users/xxx/Sites/tests/node_modules/dalek-browser-chrome/node_modules/kew/kew.js:204:25)
at Promise._chainPromise (/Users/xxx/Sites/tests/node_modules/dalek-browser-chrome/node_modules/kew/kew.js:244:13)
at Promise.then (/Users/xxx/Sites/tests/node_modules/dalek-browser-chrome/node_modules/kew/kew.js:144:13)
at /Users/xxx/Sites/tests/node_modules/dalek-browser-chrome/install.js:175:23
at loadCbs.length (/Users/xxx/Sites/tests/node_modules/dalek-browser-chrome/node_modules/npmconf/npmconf.js:76:7)
at Array.forEach (native)
at /Users/xxx/Sites/tests/node_modules/dalek-browser-chrome/node_modules/npmconf/npmconf.js:75:13
npm ERR! dalek-browser-chrome#0.0.2 install: `node install.js`
npm ERR! `sh "-c" "node install.js"` failed with 1
npm ERR!
npm ERR! Failed at the dalek-browser-chrome#0.0.2 install script.
npm ERR! This is most likely a problem with the dalek-browser-chrome 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 dalek-browser-chrome
npm ERR! There is likely additional logging output above.
npm ERR! System Darwin 12.4.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "dalek-browser-chrome" "--save-dev"
npm ERR! cwd /Users/xxx/Sites/tests
npm ERR! node -v v0.8.15
npm ERR! npm -v 1.1.66
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/xxx/Sites/tests/npm-debug.log
npm ERR! not ok code 0
i'm running Mac OS X 10.8.4. it looks like a permissions issue, but i'm running the install as follows:
sudo npm install dalek-browser-chrome --save-dev
UPDATE
I did try running this without sudo first - but got the following:
── ncp#0.4.2
├── kew#0.1.7
├── q#0.9.6
├── adm-zip#0.4.3
├── rimraf#2.2.2 (graceful-fs#2.0.0)
└── npmconf#0.1.2 (once#1.1.1, inherits#2.0.1, osenv#0.0.3, ini#1.1.0, mkdirp#0.3.5, semver#2.1.0, nopt#2.1.2, config-chain#1.1.7)
npm ERR! Error: EACCES, open '/Users/xxx/Sites/tests/package.json'
npm ERR! { [Error: EACCES, open '/Users/xxx/Sites/tests/package.json']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/Users/xxx/Sites/tests/package.json' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Darwin 12.4.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "dalek-browser-chrome" "--save-dev"
npm ERR! cwd /Users/xxx/Sites/tests
npm ERR! node -v v0.8.15
npm ERR! npm -v 1.1.66
npm ERR! path /Users/xxx/Sites/tests/package.json
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, open '/Users/xxx/Sites/tests/package.json'
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/xxx/Sites/tests/npm-debug.log
npm ERR! not ok code 0
Based on this I tried it with Sudo.
Any idea what else it might be?
The chromedriver module is attempting to run an install script that touches files outside of the module's directory.
This is a bug with the chromedriver module. It should not be trying to touch any files outside of its module folder at install time. If this is absolutely necessary, it can ask for permission from you at run time and do what it needs to do.
In order to prevent surprising exploits, npm runs package lifecycle scripts as nobody when you are running npm as root. The nobody user doesn't have permission to write to /Users/xxx/tmp (weird username you've chosen, btw), so the install script fails.
What if a package were to write to /etc/hosts or something, and add a bunch of phishing site IP addresses as the location for various bank websites? If you download a command, and then run it, and it does some bad stuff, ok, you screwed up and trusted the wrong program. But if simply installing the program does some bad stuff like this, then npm has violated your trust, and I try not to let that happen.
You could argue that you've explicitly asked to download the program, but since the web of trust with small dependencies can get very wide, it's just a bit too dangerous for me to sleep well at night, so that's why npm has this rule.
The problem could be related with the use of sudo,
the module is a local one, so you should be able to install it without the use of sudo.
After the chromedriver executable is downloaded, the installer tries to fix the permissions of the downloaded file, which might result in this problem.
Further read on to sudo or not: http://howtonode.org/introduction-to-npm