Error while installing modules using npm and expo

Viewed 119

I am fairly new to React.js and React-native. I was trying to learn basic navigation and using the documentation I came across that I need to install a navigation module. I ran expo install react-native-screens react-native-safe-area-context which led to the ERROR:

npm ERR! code ENOENT
npm ERR! syscall rename
npm ERR! path C:\Users\tanis\VScode projects\Frontend\testapp\node_modules\react-native-screens
npm ERR! dest C:\Users\tanis\VScode projects\Frontend\testapp\node_modules\.react-native-screens.DELETE
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, rename 'C:\Users\tanis\VScode projects\Frontend\testapp\node_modules\react-native-screens' -> 'C:\Users\tanis\VScode projects\Frontend\testapp\node_modules\.react-native-screens.DELETE'    
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:        
npm ERR!     C:\Users\tanis\AppData\Roaming\npm-cache\_logs\2021-11-11T14_48_44_166Z-debug.log

npm exited with non-zero code: 4294963238

After which I tried to fix any errors using I had using npm audit fix(which was a solution I found online) Where in I got a warning I did not understand:

npm WARN react-native@0.66.3 requires a peer of react@17.0.2 but none is installed. You must install peer dependencies yourself.

I also tried npm install react-navigation which ran without any errors and then expo install react-native-gesture-handler react-native-reanimated react-native-screens react-native-safe-area-context @react-native-community/masked-view to make sure I install all the dependencies which were recommended on StackOverflow and came across this error:

npm ERR! code EPERM
npm ERR! syscall rename
npm ERR! path C:\Users\tanis\VScode projects\Frontend\testapp\node_modules\react-native-gesture-handler\package.json.3463935938
npm ERR! dest C:\Users\tanis\VScode projects\Frontend\testapp\node_modules\react-native-gesture-handler\package.json    
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, rename 'C:\Users\tanis\VScode projects\Frontend\testapp\node_modules\react-native-gesture-handler\package.json.3463935938' -> 'C:\Users\tanis\VScode projects\Frontend\testapp\node_modules\react-native-gesture-handler\package.json'
npm ERR!  [OperationalError: EPERM: operation not permitted, rename 'C:\Users\tanis\VScode projects\Frontend\testapp\node_modules\react-native-gesture-handler\package.json.3463935938' -> 'C:\Users\tanis\VScode projects\Frontend\testapp\node_modules\react-native-gesture-handler\package.json'] {      
npm ERR!   cause: [Error: EPERM: operation not permitted, rename 'C:\Users\tanis\VScode projects\Frontend\testapp\node_modules\react-native-gesture-handler\package.json.3463935938' -> 'C:\Users\tanis\VScode projects\Frontend\testapp\node_modules\react-native-gesture-handler\package.json'] {
npm ERR!     errno: -4048,
npm ERR!     code: 'EPERM',
npm ERR!     syscall: 'rename',
npm ERR!     path: 'C:\\Users\\tanis\\VScode projects\\Frontend\\testapp\\node_modules\\react-native-gesture-handler\\package.json.3463935938',
npm ERR!     dest: 'C:\\Users\\tanis\\VScode projects\\Frontend\\testapp\\node_modules\\react-native-gesture-handler\\package.json'
npm ERR!   },
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'rename',
npm ERR!   path: 'C:\\Users\\tanis\\VScode projects\\Frontend\\testapp\\node_modules\\react-native-gesture-handler\\package.json.3463935938',
npm ERR!   dest: 'C:\\Users\\tanis\\VScode projects\\Frontend\\testapp\\node_modules\\react-native-gesture-handler\\package.json',
npm ERR!   parent: 'testapp'
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\tanis\AppData\Roaming\npm-cache\_logs\2021-11-11T15_01_29_494Z-debug.log

npm exited with non-zero code: 4294963248

In the latest audit I got the following results:

found 16 vulnerabilities (1 low, 4 moderate, 11 high)       
  run `npm audit fix` to fix them, or `npm audit` for detail
0 Answers
Related