npm fails with code EPERM error -4048 - npm

When I run 'npm install' in my project, I get the following failure.
I have tried manually removed the directory 'C:\Users\sacheu\AppData\Roaming\npm-cache' but I still get the following error And I am running my 'cmd' in admin mode.
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Program Files (x
6)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v6.10.3
npm ERR! npm v3.10.10
npm ERR! path C:\Users\sacheu\AppData\Roaming\npm-cache\source-map\0.5.6\packag
.tgz.1001138336
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall rename
npm ERR! Error: EPERM: operation not permitted, rename 'C:\Users\sacheu\AppData
Roaming\npm-cache\source-map\0.5.6\package.tgz.1001138336' -> 'C:\Users\sacheu\
ppData\Roaming\npm-cache\source-map\0.5.6\package.tgz'
npm ERR! at Error (native)
npm ERR! { Error: EPERM: operation not permitted, rename 'C:\Users\sacheu\AppD
ta\Roaming\npm-cache\source-map\0.5.6\package.tgz.1001138336' -> 'C:\Users\sach
u\AppData\Roaming\npm-cache\source-map\0.5.6\package.tgz'
npm ERR! at Error (native)
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'rename',
npm ERR! path: 'C:\\Users\\sacheu\\AppData\\Roaming\\npm-cache\\source-map\\0
5.6\\package.tgz.1001138336',
npm ERR! dest: 'C:\\Users\\sacheu\\AppData\\Roaming\\npm-cache\\source-map\\0
5.6\\package.tgz' }
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! c:\Users\sacheu\odsp-next\npm-debug.log

Related

npm ERR! Error: EPERM: operation not permitted, symlink

~$ npm i puppeteer
npm ERR! code EPERM
npm ERR! syscall symlink
npm ERR! path ../extract-zip/cli.js
npm ERR! dest /storage/emulated/0/Android/data/io.spck.editor.node/files/Vision/node_modules/.bin/extract-zip
npm ERR! errno -1
npm ERR! Error: EPERM: operation not permitted, symlink '../extract-zip/cli.js' -> '/storage/emulated/0/Android/data/io.spck.editor.node/files/Vision/node_modules/.bin/extract-zip'
npm ERR! [Error: EPERM: operation not permitted, symlink '../extract-zip/cli.js' -> '/storage/emulated/0/Android/data/io.spck.editor.node/files/Vision/node_modules/.bin/extract-zip'] {
npm ERR! errno: -1,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'symlink',
npm ERR! path: '../extract-zip/cli.js',
npm ERR! dest: '/storage/emulated/0/Android/data/io.spck.editor.node/files/Vision/node_modules/.bin/extract-zip'
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.
This error shows up whenever I try to install packages like - Puppeteer, Nightmare & some more...
Kinda help me in this...

npm install is not working npm ERR! code EPERM npm ERR! syscall mkdir npm ERR! path C:\Users\avtar~saini npm ERR! errno -4048

G:\angularProject\battingApp-update>npm i
npm ERR! code EPERM
npm ERR! syscall mkdir
npm ERR! path C:\Users\avtar~saini
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, mkdir 'C:\Users\avtar~saini'
npm ERR! [OperationalError: EPERM: operation not permitted, mkdir 'C:\Users\avtar~saini'] {
npm ERR! cause: [Error: EPERM: operation not permitted, mkdir 'C:\Users\avtar~saini'] {
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'mkdir',
npm ERR! path: 'C:\\Users\\avtar~saini'
npm ERR! },
npm ERR! isOperational: true,
npm ERR! stack: "Error: EPERM: operation not permitted, mkdir 'C:\\Users\\avtar~saini'",
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'mkdir',
npm ERR! path: 'C:\\Users\\avtar~saini'
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.
Looks like some permission issues.
First thing which you can do is run this command with administrative permissions.
If that doesn't work then You can try this with administrative permissions:
npm i --unsafe-perms
I think these should solve your problem

npm ERR code EPERM syscall unlink while executing npm install

Got the following error while executing npm install
node version 12.16.2
Running cmd as administrator
npm ERR! code EPERM
npm ERR! syscall unlink
npm ERR! path D:\Projects\BTP\Medical-Project\client\node_modules\.staging\npm-9e4fc1a9\man\man5\package-locks.5
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, unlink 'D:\Projects\BTP\Medical-Project\client\node_modules\.staging\npm-9e4fc1a9\man\man5\package-locks.5'
npm ERR! [OperationalError: EPERM: operation not permitted, unlink 'D:\Projects\BTP\Medical-Project\client\node_modules\.staging\npm-9e4fc1a9\man\man5\package-locks.5'] {
npm ERR! cause: [Error: EPERM: operation not permitted, unlink 'D:\Projects\BTP\Medical-Project\client\node_modules\.staging\npm-9e4fc1a9\man\man5\package-locks.5'] {
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path: 'D:\\Projects\\BTP\\Medical-Project\\client\\node_modules\\.staging\\npm-9e4fc1a9\\man\\man5\\package-locks.5'
npm ERR! },
npm ERR! stack: "Error: EPERM: operation not permitted, unlink 'D:\\Projects\\BTP\\Medical-Project\\client\\node_modules\\.staging\\npm-9e4fc1a9\\man\\man5\\package-locks.5'",
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path: 'D:\\Projects\\BTP\\Medical-Project\\client\\node_modules\\.staging\\npm-9e4fc1a9\\man\\man5\\package-locks.5',
npm ERR! parent: 'client'
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\kz\AppData\Roaming\npm-cache\_logs\2021-04-01T18_15_01_424Z-debug.log
I tried :
npm cache clean --force
deleted node_modules and installed again
disabled antivirus
Restarting laptop :)
I was able to fix this by
Closing any open prompts and editors eg. VSCode.
Opening the terminal or CMD as admin and running npm-install again.
I think the IDE is 'locking a file'.

npm ERR! errno -4048

After 1 week break, I opened my pc again and when I want to 'expo start' from command window I get error like " 'expo' is not recognized as an internal or external command,operable program or batch file. " . And I tried to uninstall and install expo again and when I call " npm install --global expo-cli " I got this error.
npm ERR! code EPERM
npm ERR! syscall unlink
npm ERR! path C:\Users\tuna\AppData\Roaming\npm\node_modules\expo-cli\node_modules\#expo\.xdl.DELETE\binaries\windows\adb\AdbWinUsbApi.dll
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, unlink 'C:\Users\tuna\AppData\Roaming\npm\node_modules\expo-cli\node_modules\#expo\.xdl.DELETE\binaries\windows\adb\AdbWinUsbApi.dll'
npm ERR! [OperationalError: EPERM: operation not permitted, unlink 'C:\Users\tuna\AppData\Roaming\npm\node_modules\expo-cli\node_modules\#expo\.xdl.DELETE\binaries\windows\adb\AdbWinUsbApi.dll'] {
npm ERR! cause: [Error: EPERM: operation not permitted, unlink 'C:\Users\tuna\AppData\Roaming\npm\node_modules\expo-cli\node_modules\#expo\.xdl.DELETE\binaries\windows\adb\AdbWinUsbApi.dll'] {
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path: 'C:\\Users\\tuna\\AppData\\Roaming\\npm\\node_modules\\expo-cli\\node_modules\\#expo\\.xdl.DELETE\\binaries\\windows\\adb\\AdbWinUsbApi.dll'
npm ERR! },
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path: 'C:\\Users\\tuna\\AppData\\Roaming\\npm\\node_modules\\expo-cli\\node_modules\\#expo\\.xdl.DELETE\\binaries\\windows\\adb\\AdbWinUsbApi.dll',
npm ERR! parent: 'expo-cli'
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\tuna\AppData\Roaming\npm-cache\_logs\2020-10-03T15_36_23_690Z-debug.log
I couldnt find any solution that looks like my problem. Anybody has an idea to solve this problem.
Thanks in advance.

"npm install -g newman" command is not working for installing newman in windows

C:\Users\Atanu>node -v
v10.16.0
C:\Users\Atanu>npm -v
6.9.0
C:\Users\Atanu>npm install -g newman
npm ERR! path C:\Program Files\Vbrick\nodejs\node_modules.staging
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall mkdir
npm ERR! Error: EPERM: operation not permitted, mkdir 'C:\Program Files\Vbrick\nodejs\node_modules.staging'
npm ERR! { [Error: EPERM: operation not permitted, mkdir 'C:\Program Files\Vbrick\nodejs\node_modules.staging']
npm ERR! cause:
npm ERR! { Error: EPERM: operation not permitted, mkdir 'C:\Program Files\Vbrick\nodejs\node_modules.staging'
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'mkdir',
npm ERR! path: 'C:\Program Files\Vbrick\nodejs\node_modules\.staging' },
npm ERR! stack:
npm ERR! 'Error: EPERM: operation not permitted, mkdir \'C:\Program Files\Vbrick\nodejs\node_modules\.staging\'',
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'mkdir',
npm ERR! path: 'C:\Program Files\Vbrick\nodejs\node_modules\.staging',
npm ERR! parent: 'newman' }
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 (though this is not recommended).
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Atanu\AppData\Roaming\npm-cache_logs\2020-02-20T06_37_27_595Z-debug.log
Try running the command prompt as admin.