How to install Yoeman on Ubuntu18.04 - npm

I am installing Yeoman on my machine and ran this
npm install -g yo
This is giving me permission error:
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/nvm/versions/node/v12.16.1/lib/node_modules/yo
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/nvm/versions/node/v12.16.1/lib/node_modules/yo'
npm ERR! [Error: EACCES: permission denied, access '/usr/local/nvm/versions/node/v12.16.1/lib/node_modules/yo'] {
npm ERR! stack: "Error: EACCES: permission denied, access '/usr/local/nvm/versions/node/v12.16.1/lib/node_modules/yo'",
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/nvm/versions/node/v12.16.1/lib/node_modules/yo'
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/siddharth/.npm/_logs/2020-04-24T22_31_29_025Z-debug.log
But this got resolved by attaching sudo
Now I am getting this error:
Yeoman Doctor
Running sanity checks on your system
✔ No .bowerrc file in home directory
✔ Global configuration file is valid
✔ NODE_PATH matches the npm root
✔ No .yo-rc.json file in home directory
✔ Node.js version
✔ npm version
Error: Couldn't find the 'yo' binary. Make sure it's installed and in your $PATH
at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21) {
errno: 'ENOENT',
code: 'ENOENT',
syscall: 'spawn yo',
path: 'yo',
spawnargs: [ '--version' ],
cmd: 'yo --version'
}
✖ yo version
Error: Couldn't find the 'yo' binary. Make sure it's installed and in your $PATH
at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21) {
errno: 'ENOENT',
code: 'ENOENT',
syscall: 'spawn yo',
path: 'yo',
spawnargs: [ '--version' ],
cmd: 'yo --version'
}
Found potential issues on your machine :(
+ yo#3.1.1
updated 1 package in 29.492s
Running yo --version is giving zsh: command not found: yo
I tried this https://stackoverflow.com/a/58277450/10309895 but this is also not working for me
:,(

Related

I'm trying to download Sanity for this particular project but for some reason on the terminal it's showing this

I'm trying to install Sanity for this project but I'm having trouble installing it and it shows this.
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /usr/local/lib/node_modules/#sanity
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/#sanity'
npm ERR! [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/#sanity'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'mkdir',
npm ERR! path: '/usr/local/lib/node_modules/#sanity'
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! /Users/****/.npm/_logs/2022-08-03T22_03_07_802Z-debug-0.log
zsh: command not found: sanity

How to solve Error: EACCES: permission denied in pm2?

I don't know why I encounter this error, when I run pm2 status:
kaitoSwift#kaito-MacBook-Pro school-sms2 % pm2 status
node:internal/fs/utils:344
throw err;
^
Error: EACCES: permission denied, open '/Users/kaitoSwift/.pm2/pm2.log'
at Object.openSync (node:fs:585:3)
at module.exports.Client.launchDaemon (/usr/local/lib/node_modules/pm2/lib/Client.js:228:12)
at /usr/local/lib/node_modules/pm2/lib/Client.js:104:10
at /usr/local/lib/node_modules/pm2/lib/Client.js:321:14
at processTicksAndRejections (node:internal/process/task_queues:78:11)
at runNextTicks (node:internal/process/task_queues:65:3)
at listOnTimeout (node:internal/timers:528:9)
at processTimers (node:internal/timers:502:7) {
errno: -13,
syscall: 'open',
code: 'EACCES',
path: '/Users/kaitoSwift/.pm2/pm2.log'
}
When I tried to download pm2 using npm install pm2 -g:
kevintrinidad#kaito-MacBook school-sms2 % npm install pm2 -g
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /usr/local/lib/node_modules/pm2
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/pm2'
npm ERR! [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/pm2'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'mkdir',
npm ERR! path: '/usr/local/lib/node_modules/pm2'
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! /Users/kaitoSwift/.npm/_logs/2022-04-07T11_15_28_141Z-debug-0.log
It is a permission error
If you are trying to use pm2 in ubuntu server on EC2 and getting error for error: EACCES and code :-13
Just follow these steps:
sudo su - to get to the root user permissions
then create an ecosystem.config.js file in the root folder:-
module.exports = {
apps : [{
name: "server",
script: "server.js"
}]
}
then write pm2 start server
For installing PM2, use this:
sudo npm install -g pm2
For the error with pm2 status it's the same try with:
sudo pm2 status
The error tell you that /Users/kaitoSwift/.pm2/pm2.log does not exists.
you need to run this in sudo and verify that you didn't have other process that run on the same port.

Can't install json-server

I am trying to install JSON-Server, but it's not working!
I have used the following command: npm install -g json-server
Here is the error message:
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /usr/local/lib/node_modules/json-server
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/json-server'
npm ERR! [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/json-server'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'mkdir',
npm ERR! path: '/usr/local/lib/node_modules/json-server'
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.
Try to use sudo before command :
sudo npm install -g json-server

How to install expo cli correctly?

I am trying to install expo cli globally but I am getting errors:
OS: Catalina 10.15.4
Node: 14.6
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! /Users/mac/.npm/_logs/2020-07-25T10_36_46_119Z-debug.log
I install in the Visual Studio terminal, I also tried to install through the console, but the result did not change
When installing some packages globally, you need to do so as a privileged user. On Mac, use sudo to elevate the installation command. E.g. sudo npm install your-package -g

How to run npm.cmd?

I stumbled over this discussion:
https://github.com/nodejs/node/issues/3675
when googling this error:
{ Error: spawn npm ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
at onErrorNT (internal/child_process.js:415:16)
at process._tickCallback (internal/process/next_tick.js:63:19)
errno: 'ENOENT',
code: 'ENOENT',
syscall: 'spawn npm',
path: 'npm',
spawnargs: [ 'root', '-g' ] }
but I dont know how to access this npm.cmd. I was on their site https://www.npmjs.com/package/node-cmd
and I installed it with npm install node-cmd
but Im pretty clueless how to run it, Im getting errors like this when typing
npm run node-cmd
npm ERR! path D:\nodeJS\node-v10.16.0-win-x64\package.json
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open 'D:\nodeJS\node-v10.16.0-win-x64\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
Basically, I want to run this node-cmd inside my project so I can (hopefully) execute:
npx webpack-cli init
successfully
if you're running under win32 try for example:
When installing packages
npm.cmd install
or Run npm scripts syncrhonously
npm.cmd run sync -- --init