npm uninstall -g create-react-app Error: EPERM: operation not permitted - npm

When creating a new react app with npx ( npx create-react-app new_app --use-npm --template typescript) I get the following error:
You are running `create-react-app` 4.0.3, which is behind the latest release (5.0.0).
We no longer support global installation of Create React App.
Please remove any global installs with one of the following commands:
- npm uninstall -g create-react-app
- yarn global remove create-react-app
Yet running npm uninstall -g create-react-app I get a permissions error:
npm WARN locking Error: EPERM: operation not permitted, open 'C:\Users\MYCOMP~1\AppData\Roaming\npm-cache\_locks\staging-abfecabb8ac6a958.lock'
npm WARN locking C:\Users\MYCOMP~1\AppData\Roaming\npm-cache\_locks\staging-abfecabb8ac6a958.lock failed [Error: EPERM: operation not permitted, open 'C:\Users\MYCOMP~1\AppData\Roaming\npm-cache\_locks\staging-abfecabb8ac6a958.lock'] {
npm WARN locking errno: -4048,
npm WARN locking code: 'EPERM',
npm WARN locking syscall: 'open',
npm WARN locking path: 'C:\\Users\\MYCOMP~1\\AppData\\Roaming\\npm-cache\\_locks\\staging-abfecabb8ac6a958.lock'
npm WARN locking }
npm ERR! code EPERM
npm ERR! syscall open
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, open 'C:\Users\MYCOMP~1\AppData\Roaming\npm-cache\_locks\staging-abfecabb8ac6a958.lock'
npm ERR! [Error: EPERM: operation not permitted, open 'C:\Users\MYCOMP~1\AppData\Roaming\npm-cache\_locks\staging-abfecabb8ac6a958.lock'] {
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'open',
npm ERR! path: 'C:\\Users\\MYCOMP~1\\AppData\\Roaming\\npm-cache\\_locks\\staging-abfecabb8ac6a958.lock'
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.
PS C:\Users\Primary User\Desktop\seisolosite\newseisolosite\CSS3DDemo> npm uninstall -g create-react-app
npm WARN locking Error: EPERM: operation not permitted, open 'C:\Users\MYCOMP~1\AppData\Roaming\npm-cache\_locks\staging-abfecabb8ac6a958.lock'
npm WARN locking C:\Users\MYCOMP~1\AppData\Roaming\npm-cache\_locks\staging-abfecabb8ac6a958.lock failed [Error: EPERM: operation not permitted, open 'C:\Users\MYCOMP~1\AppData\Roaming\npm-cache\_locks\staging-abfecabb8ac6a958.lock'] {
npm WARN locking errno: -4048,
npm WARN locking code: 'EPERM',
npm WARN locking syscall: 'open',
npm WARN locking path: 'C:\\Users\\MYCOMP~1\\AppData\\Roaming\\npm-cache\\_locks\\staging-abfecabb8ac6a958.lock'
npm WARN locking }
npm ERR! code EPERM
npm ERR! syscall open
npm ERR! path C:\Users\MYCOMP~1\AppData\Roaming\npm-cache\_locks\staging-abfecabb8ac6a958.lock
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, open 'C:\Users\MYCOMP~1\AppData\Roaming\npm-cache\_locks\staging-abfecabb8ac6a958.lock'
npm ERR! [Error: EPERM: operation not permitted, open 'C:\Users\MYCOMP~1\AppData\Roaming\npm-cache\_locks\staging-abfecabb8ac6a958.lock'] {
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'open',
npm ERR! path: 'C:\\Users\\MYCOMP~1\\AppData\\Roaming\\npm-cache\\_locks\\staging-abfecabb8ac6a958.lock'
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.
Running yarn uninstall -g create-react-app works just fine:
yarn global v1.22.10
[1/2] Removing module create-react-app...
[2/2] Regenerating lockfile and installing missing dependencies...
info fsevents#2.3.2: The platform "win32" is incompatible with this module.
info "fsevents#2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.
warning "depcheck > #vue/compiler-sfc#3.1.5" has unmet peer dependency "vue#3.1.5".
success Uninstalled packages.
Ok great, so I should be set now, right??
But then I run npx create-react-app my-app --template typescript and get the same error, we We no longer support global installation of Create React App.. Restarting the computer and running the command in a new terminal does nothing. Retrying with yarn instead of npx doesn't work either, running yarn create react-app my-app --template typescript gives error:
'C:\Users\Primary' is not recognized as an internal or external command,
operable program or batch file.
So I'm pretty much completely stuck, with neither yarn or npx working with creat-react-app. Any clues on how to get one of them working?
OS: Windows 10

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.

I couldn't install import sass into my project

when I run the command
npm install --save-dev sass
from bootstrap-v5 folder I'm getting this error shown below
npm ERR! code EPERM
npm ERR! syscall symlink
npm ERR! path ../sass/sass.js
npm ERR! dest/storage/emulated/0/Android/data/io.spck/files/New_Portfolio_project/bootstrap-v5/node_modules/.bin/sass
npm ERR! errno -1
npm ERR! Error: EPERM: operation not permitted, symlink '../sass/sass.js' -> '/storage/emulated/0/Android/data/io.spck/files/New_Portfolio_project/bootstrap-v5/node_modules/.bin/sass'
npm ERR! [Error: EPERM: operation not permitted, symlink '../sass/sass.js' -> '/storage/emulated/0/Android/data/io.spck/files/New_Portfolio_project/bootstrap-v5/node_modules/.bin/sass'] {
npm ERR! errno: -1,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'symlink',
npm ERR! path: '../sass/sass.js',
npm ERR! dest: '/storage/emulated/0/Android/data/io.spck/files/New_Portfolio_project/bootstrap-v5/node_modules/.bin/sass'
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! /data/data/com.termux/files/home/.npm/_logs/2021-09-29T17_41_24_947Z-debug.log
But I was able to install sass globally with the command npm i -g sass.
I'm just trying this out for the first time. And, is there any way to import sass to my project as I have already installed sass globally?
Try npm install node-sass instead of npm install sass

Why do I get these errors when I type npm install in the terminal?

Whenever I install anything with npm, I get the following error list:
npm ERR! code EPERM
npm ERR! syscall mkdir
npm ERR! path C:\Users\Firstname~1
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, mkdir 'C:\Users\Firstname~1'
npm ERR! [OperationalError: EPERM: operation not permitted, mkdir 'C:\Users\Firstname~1'] {
npm ERR! cause: [Error: EPERM: operation not permitted, mkdir 'C:\Users\Firstname~1'] {
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'mkdir',
npm ERR! path: 'C:\\Users\\Firstname~1'
npm ERR! },
npm ERR! isOperational: true,
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'mkdir',
npm ERR! path: 'C:\\Users\\Firstname~1'
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.
How can I resolve this? How can I run npm install by administrator?
Looks like an npm misconfiguration issue.
Ideally, you can configure it to use only directories that your user has access, so you won't need admin privileges just to install global packages.
First, check what's the npm prefix using a command like
npm config ls -l
I bet it will show something like
prefix = "C:\\Users\\"
Try to create at C:\Users{username}\ where {username} is your own, a .npmrc file with an entry like
prefix = "C:\\Users\\{username}\\some_dir_you_have_access"
Then use -g like npm install -g package, this way npm will try to install global packages in the path specified by "prefix" you've defined.
npm folders are documented here https://docs.npmjs.com/cli/v7/configuring-npm/folders

npm start isn't working, react-native app

im trying to build react-native app.
running the commands on gitBash, windows10.
when im trying to run 'npm start' im getting this error:
Fixed , just installed again expo-cli in the rn-starter folder, thanks for the answers :)
$ npm start
> # start C:\Users\Liran\food
> expo start
'expo-cli' is not recognized as an internal or external command,
operable program or batch file.
This command requires Expo CLI.
Do you want to install it globally [Y/n]? Y
Installing the package 'expo-cli'...
npm ERR! code EPERM
npm ERR! syscall unlink
npm ERR! path C:\Users\Liran\AppData\Roaming\npm\node_modules\expo-cli\node_modules\#expo\.xdl.DELETE\binaries\windows\adb\AdbWinApi.dll
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, unlink 'C:\Users\Liran\AppData\Roaming\npm\node_modules\expo-cli\node_modules\#expo\.xdl.DELETE\binaries\windows\adb\AdbWinApi.dll'
npm ERR! [OperationalError: EPERM: operation not permitted, unlink 'C:\Users\Liran\AppData\Roaming\npm\node_modules\expo-cli\node_modules\#expo\.xdl.DELETE\binaries\windows\adb\AdbWinApi.dll'] {
npm ERR! cause: [Error: EPERM: operation not permitted, unlink 'C:\Users\Liran\AppData\Roaming\npm\node_modules\expo-cli\node_modules\#expo\.xdl.DELETE\binaries\windows\adb\AdbWinApi.dll'] {
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path: 'C:\\Users\\Liran\\AppData\\Roaming\\npm\\node_modules\\expo-cli\\node_modules\\#expo\\.xdl.DELETE\\binaries\\windows\\adb\\AdbWinApi.dll'
npm ERR! },
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path: 'C:\\Users\\Liran\\AppData\\Roaming\\npm\\node_modules\\expo-cli\\node_modules\\#expo\\.xdl.DELETE\\binaries\\windows\\adb\\AdbWinApi.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\Liran\AppData\Roaming\npm-cache\_logs\2020-10-19T09_36_58_255Z-debug.log
Installing Expo CLI failed. You can install it manually with:
npm install --global expo-cli
npm ERR! code ELIFECYCLE
npm ERR! errno 4294963248
npm ERR! # start: `expo start`
npm ERR! Exit status 4294963248
npm ERR!
npm ERR! Failed at the # start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Liran\AppData\Roaming\npm-cache\_logs\2020-10-19T09_36_58_348Z-debug.log
help please someone :)
Open windows terminal as Administrator and run command:
install --global expo-cli
then from the root of your project you can either run expo start or npm start both will do.
You need to install Expo CLI package.
see: https://docs.expo.io/workflow/expo-cli/
install:
npm install -g expo-cli
If you still getting same error do these two steps;
Be sure about working on terminal as administrator
If you're using an antivirus program, STOP it while trying to execute above command.

npg sudden error installing things

When I try to install npm install _____ I get this weird error I've never seen before. I opened powershell as admin and tried there, but got the same error. Also tried installing in safe mode, turning off many programs, npm cache clean --force, deleting and re-installing npm, cmd as admin, and many other things...
It was working fine last night, but when I woke up it stopped working....
PS Z:\myapp> npm install #google/maps
npm ERR! path Z:\myapp\node_modules\fsevents\node_modules\abbrev\package.json
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall unlink
npm ERR! Error: EPERM: operation not permitted, unlink 'Z:\myapp\node_modules\fsevents\node_modules\abbrev\package.json'
npm ERR! at Error (native)
npm ERR! { Error: EPERM: operation not permitted, unlink 'Z:\myapp\node_modules\fsevents\node_modules\abbrev\package.json'
npm ERR! at Error (native)
npm ERR! stack: 'Error: EPERM: operation not permitted, unlink \'Z:\\myapp\\node_modules\\fsevents\\node_modules\\abbrev\\package.json\'\n at Error (native)',
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path: 'Z:\\myapp\\node_modules\\fsevents\\node_modules\\abbrev\\package.json' }
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! C:\Users\AppData\Roaming\npm-cache\_logs\2017-09-12T13_11_39_774Z-debug.log
It freezes at postinstall: info lifecycle #types/googlemaps#3.26.20~postinstall: #types/googlemaps#3.26.20 then eventually just crashes totally.
Try using --no-optional while installing any package.
npm install nodemon --no-optional