'pm2' is not recognized as an internal or external command, operable program or batch file error - npm-install

Here is the error message I am getting while pm2 install, tried to clean cache and also run in admin mode but no use, what could be the issue?may be having forever also install affecting it?
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'rename',
npm ERR! path: 'D:\\Users\\xxx\\AppData\\Roaming\\npm\\node_modules\\pm2\\package.json.3819841862',
npm ERR! dest: 'D:\\Users\\xxx\\AppData\\Roaming\\npm\\node_modules\\pm2\\package.json'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
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
.

If you have ruled out admin privilages from being the problem, then it is another program- have you tried disabling an antivirus if one is running?
After that if the issue presists, I'd go into the task manager and stop any redundant processes.
If even after that you are still having this problem, I'd reinstall pm2 globally

Related

Npm error occuring when trying to run npm install -g npm

Receiving the foillowing error, when I try to search C:\Users\harka\AppData\Roaming\npm\node_modules\npm\node_modules.node-gyp.DELETE\node_modules#npmcli via run app it tell mes that it cannot find the file
error when using run command to find path
Picture of error code in cmd
C:\GreaterWMS\templates>npm install -g npm
npm ERR! code EPERM
npm ERR! syscall rename
npm ERR! path C:\Users\harka\AppData\Roaming\npm\node_modules\npm\node_modules.node-gyp.DELETE\node_modules#npmcli
npm ERR! dest C:\Users\harka\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\node_modules#npmcli
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, rename 'C:\Users\harka\AppData\Roaming\npm\node_modules\npm\node_modules.node-gyp.DELETE\node_modules#npmcli' -> 'C:\Users\harka\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\node_modules#npmcli'
npm ERR! [OperationalError: EPERM: operation not permitted, rename 'C:\Users\harka\AppData\Roaming\npm\node_modules\npm\node_modules.node-gyp.DELETE\node_modules#npmcli' -> 'C:\Users\harka\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\node_modules#npmcli'] {
npm ERR! cause: [Error: EPERM: operation not permitted, rename 'C:\Users\harka\AppData\Roaming\npm\node_modules\npm\node_modules.node-gyp.DELETE\node_modules#npmcli' -> 'C:\Users\harka\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\node_modules#npmcli'] {
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'rename',
npm ERR! path: 'C:\Users\harka\AppData\Roaming\npm\node_modules\npm\node_modules\.node-gyp.DELETE\node_modules\#npmcli',
npm ERR! dest: 'C:\Users\harka\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\node_modules\#npmcli'
npm ERR! },
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'rename',
npm ERR! path: 'C:\Users\harka\AppData\Roaming\npm\node_modules\npm\node_modules\.node-gyp.DELETE\node_modules\#npmcli',
npm ERR! dest: 'C:\Users\harka\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\node_modules\#npmcli',
npm ERR! parent: 'npm'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
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! C:\Users\harka\AppData\Roaming\npm-cache_logs\2022-11-15T14_28_23_790Z-debug.log
I have no idea how to fix this error, I have tried creating a temporary cache I have wiped my entire computer and reset and restarted the entire process from scratch but I keep receiving this same error.
I have turned off my firewall
2.I have turned off all anti virus software
3.I have tried deleting the Roaming data npm folder and tried to reinstall npm, but everything that I try to do nothing will fix this error.
thought maybe because my user for my microsoft is 2 names (First and Last, I then turn my pc into a local machine so it the user would only be "harka"
And have you installed npm previously, can you run for example npm -v ? if not, that means u don't have npm installed at all and you trying to use it to install npm (if I am not mistaken)
Then assuming you are using windows, the best way to install npm to windows is to download node.js from their official website, which installs npm as well.

'expo' is not recognized as an internal or external command, operable program or batch file

I am getting this error when I try to use expo commands.
npm ERR! code EPERM npm ERR! syscall rename npm ERR! path
C:\Users\Sri\AppData\Roaming\npm\node_modules\expo-cli npm ERR! dest
C:\Users\Sri\AppData\Roaming\npm\node_modules.expo-cli-JgrrLjT2 npm
ERR! errno -4048 npm ERR! Error: EPERM: operation not permitted,
rename 'C:\Users\Sri\AppData\Roaming\npm\node_modules\expo-cli' ->
'C:\Users\Sri\AppData\Roaming\npm\node_modules.expo-cli-JgrrLjT2' npm
ERR! [Error: EPERM: operation not permitted, rename
'C:\Users\Sri\AppData\Roaming\npm\node_modules\expo-cli' ->
'C:\Users\Sri\AppData\Roaming\npm\node_modules.expo-cli-JgrrLjT2'] {
npm ERR! errno: -4048, npm ERR! code: 'EPERM', npm ERR! syscall:
'rename', npm ERR! path:
'C:\Users\Sri\AppData\Roaming\npm\node_modules\expo-cli', npm
ERR! dest:
'C:\Users\Sri\AppData\Roaming\npm\node_modules\.expo-cli-JgrrLjT2'
npm ERR! } npm ERR! npm ERR! The operation was rejected by your
operating system. npm ERR! It's possible that the file was already in
use (by a text editor or antivirus), npm ERR! or that you lack
permissions to access it. 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!
C:\Users\Sri\AppData\Local\npm-cache_logs\2020-12-31T06_02_09_505Z-debug.log
C:\Users\Sri\AppData\Roaming\npm\node_modules\expo-cli
I followed the above path and found that expo-cli folder was there but when I try to init or uninstall expo it says 'expo' is not recognized as internal or external command.
if your in right directory perhaps the binary you are trying to execute does'nt exist there ,maybe the executable is named something else and if you are trying from another directory you should add the executable to system variables here's the link to do so

How can i install yeoman command line tool on ubuntu 20.04.1 LTS?

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.

Error: “The operation was rejected by your operating system” when trying to update expo-cli

npm ERR! code EPERM
npm ERR! syscall rename
npm ERR! path C:\Users\Avinash\AppData\Roaming\npm\node_modules\expo-cli
npm ERR! dest C:\Users\Avinash\AppData\Roaming\npm\node_modules.expo-cli-MaHHbGHy
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, rename 'C:\Users\Avinash\AppData\Roaming\npm\node_modules\expo-cli' -> 'C:\Users\Avinash\AppData\Roaming\npm\node_modules.expo-cli-MaHHbGHy'
npm ERR! [Error: EPERM: operation not permitted, rename 'C:\Users\Avinash\AppData\Roaming\npm\node_modules\expo-cli' -> 'C:\Users\Avinash\AppData\Roaming\npm\node_modules.expo-cli-MaHHbGHy'] {
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'rename',
npm ERR! path: 'C:\Users\Avinash\AppData\Roaming\npm\node_modules\expo-cli',
npm ERR! dest: 'C:\Users\Avinash\AppData\Roaming\npm\node_modules\.expo-cli-MaHHbGHy'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
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! C:\Users\Avinash\AppData\Local\npm-cache_logs\2020-11-28T06_08_17_131Z-debug.log
Please try following steps:
check your antivirus status is enable or disable
disable your antivirus during the installation.
I hope this helps. It worked for me.
Open cmd as administrator , this is permission error
Also try to see if the file is in use :
https://learn.microsoft.com/en-us/sysinternals/downloads/process-explorer
https://helpcenter.gsx.com/hc/en-us/articles/115015880627-How-to-Identify-which-Windows-Process-is-Locking-a-File-or-Folder
Open Process Explorer
Running as administrator. On the toolbar, find the gunsight icon on the right. Drag the icon and drop it on the open file or folder
that is locked. The executable that is using the file will be
highlighted in the Process Explorer main display list.
Alongside opening your command prompt window with administrator privileges, try killing the process adb.exe, which can be found by opening your Task Manager and navigating to the Details tab. This GitHub issue has a few other possible solutions you can try.
I found it was because I had the folder open in my code editor. Closed it and ran the npm install command and it worked.
Check if you have explorer or some folder open. Closing that folder/explorer solved my problem

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