Unable to update or execute the 'expo' command in command prompt - npm

For the first time i tried to install the expo-cli on my project directory it worked. I can use expo init to make my first react native app in my command prompt, and run the app with expo start. But now when i have some new project to make with the 'expo' command like expo init or expo start or something else, it didn't work anymore. When i tried to type and enter the expo command, its always be
'expo' is not recognized as an internal or external command, operable program or batch file.
And now when i tried to update the expo-cli with npm install -g expo-cli a warning of error appeared.
npm ERR! code EPERM
npm ERR! syscall rename
npm ERR! path C:\Users\ACER\AppData\Roaming\npm\node_modules\expo-cli
npm ERR! dest C:\Users\ACER\AppData\Roaming\npm\node_modules\.expo-cli-foqoNR8w
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, rename 'C:\Users\ACER\AppData\Roaming\npm\node_modules\expo-cli' -> 'C:\Users\ACER\AppData\Roaming\npm\node_modules\.expo-cli-foqoNR8w'
npm ERR! [Error: EPERM: operation not permitted, rename 'C:\Users\ACER\AppData\Roaming\npm\node_modules\expo-cli' -> 'C:\Users\ACER\AppData\Roaming\npm\node_modules\.expo-cli-foqoNR8w'] {
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'rename',
npm ERR! path: 'C:\\Users\\ACER\\AppData\\Roaming\\npm\\node_modules\\expo-cli',
npm ERR! dest: 'C:\\Users\\ACER\\AppData\\Roaming\\npm\\node_modules\\.expo-cli-foqoNR8w'
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\ACER\AppData\Local\npm-cache\_logs\2021-01-10T17_18_03_575Z-debug.log
This preventing me from doing the installation of react navigation and make a new project by using 'expo' command. And i've been search this problem on and tried to solve it but it didn't work on any various ways that i've tried. I've tried to reinstall the expo-cli but it didn't work, i've tried to use yarn as well but still it didn't work. I've been re-added the path for the npm and even tried to reinstall nodejs and use any various code for updating and installing the 'expo-cli' but it didn't work as expected.
Any suggest on how do i can fix this problem ?

Run your command line as Admin and then do the following:
npm remove -g expo-cli to remove the existing CLI
and then npm i -g expo-cli to reinstall the Expo CLI.
Then you can simply login via expo login (if you were logged in) and take off from where you were!

I delete the expo file on the path :
C:\Users\ACER\AppData\Roaming\npm\node_modules\expo-cli
C:\Users\ACER\AppData\Roaming\npm\node_modules\.expo-cli-foqoNR8w
the file that i deleted : expo-cli & .expo-cli-foqoNR8w
And then try to install the expo-cli again with npm install --global expo-cli then it work. Now i can use my expo start or whatever code with 'expo' in it. And also now i can install react navigation on my project directory. And i'm running the installation by using command prompt run as admin.

Related

Cannot install react-native-vector-icons/Ionicons in visual studio code

I'm trying to use Ionicons in react native with vscode. But when I type the command:
npm install react-native-vector-icons/Ionicons
I receive the error:
PS C:\ReactNProjects\test230215> npm install react-native-vector-icons/Ionicons
npm ERR! code 128
npm ERR! An unknown git error occurred
npm ERR! command git --no-replace-objects ls-remote ssh://git#github.com/react-native-vector-icons/Ionicons.git
npm ERR! git#github.com: Permission denied (publickey).
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
I tried removing the nod_modules folder and tried to install again but still nog success. Does anyone have a clue?
You need to install react-native-vector-icons instead of react-native-vector-icons/Ionicons as docs. After following instructions you can simply use it by importing.
Are you sure of your npm command?
I found this command: npm install --save react-native-vector-icons
(source: https://github.com/oblador/react-native-vector-icons#installation)
And then you import react-native-vector-icons/Ionicons at the top of your js/ts file(s)

I can't create react app by using npx create-react-app it takes long time and shows this type of error

Creating a new React app in G:\My Drive\projects\portfolio\my-app.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
npm ERR! code ENOTDIR
npm ERR! syscall mkdir
npm ERR! path G:\My Drive\projects\portfolio\my-
app\node_modules\webpack\node_modules
npm ERR! errno -4052
npm ERR! ENOTDIR: not a directory, mkdir 'G:\My
Drive\projects\portfolio\my-app\node_modules\webpack\node_modules'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\user\AppData\Local\npm-cache\_logs\2023-01-
20T08_59_44_240Z-debug-0.log
Aborting installation.
npm install --no-audit --save --save-exact --loglevel error react react-
dom react-scripts cra-template has failed.
Deleting generated file... package.json
Deleting my-app/ from G:\My Drive\projects\portfolio
Done.
I'm a front-end Developer. I uninstall the nodejs couple of times and then try these commands: "npm cache clean --force", npm uninstall -g create-react-app then reinstall create-react-app but it doesn't work, also updated the latest version of nodejs, use yarn also but couldn't solve the problem, delete the node_modules but it couldn't work, if anyone here pls help me!

npm ERR! code ENOTEMPTY npm ERR! syscall rename

when I try to initialize a react-native project I am getting this error. Anyone know how to resolve this please help
i am using mac
Need to install the following packages:
react-native
Ok to proceed? (y) y
npm ERR! code ENOTEMPTY
npm ERR! syscall rename
npm ERR! path /Users/codelanticdeveloper/.npm/_npx/7930a8670f922cdb/node_modules/react-native
npm ERR! dest /Users/codelanticdeveloper/.npm/_npx/7930a8670f922cdb/node_modules/.react-native-QIQKGFeg
npm ERR! errno -66
npm ERR! ENOTEMPTY: directory not empty, rename '/Users/codelanticdeveloper/.npm/_npx/7930a8670f922cdb/node_modules/react-native' -> '/Users/codelanticdeveloper/.npm/_npx/7930a8670f922cdb/node_modules/.react-native-QIQKGFeg'
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/codelanticdeveloper/.npm/_logs/2022-02-16T15_54_46_715Z-debug-0.log
where it says...
directory not empty, rename '/Users/codelanticdeveloper/.npm/_npx/7930a8670f922cdb/node_modules/react-native' -> '/Users/codelanticdeveloper/.npm/_npx/7930a8670f922cdb/node_modules/.react-native-QIQKGFeg'
delete the file after the arrow and try again
rm -rf '/Users/codelanticdeveloper/.npm/_npx/7930a8670f922cdb/node_modules/.react-native-QIQKGFeg'
Try deleting all the files in the node modules that end with a similar names, like '*-QIQKGFeg'
I did it manually and it worked for me
I also had this problem and fixed it by:
Deleting the problematic Expo files here per the instructions here I'm trying to reinstall expo-cli package globally with the command sudo npm install --g expo-cli note that I try --force
In the terminal, running nvm install 16.14.0 (this will download the correct Node.js LTS release that is required by Expo)
In the terminal, running brew install watchman (this is required by Expo)
In the terminal, running npm install --global expo-cli (globally downloading Expo again)
In the terminal, running expo init my-app to finally create the new app successfully!

Missing write access error on nativescript install

When I attempt to install nativescrtipt by running npm i -g nativescript, I receive the following error:
npm WARN checkPermissions Missing write access to
/usr/local/lib/node_modules/nativescript
npm ERR! path /usr/local/lib/node_modules/nativescript
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall access
npm ERR! enoent ENOENT: no such file or directory, access
'/usr/local/lib/node_modules/nativescript'
npm ERR! enoent This is related to npm not being able to find a
file.
I have tried to run the command as sudo and receive the same result. I also attempted to add write permission to the node_modules directory.
I am running node v10.6.0 on macOS High Sierra.
Add sudo command to allow you run the program with security privilege
sudo npm i -g nativescript
I followed this link: https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally to resolve the issue.
I installed nvm and updated to the latest version of node. Then, the command npm i -g nativescript successfully installed the nativescript-cli.
The issue does not appear to be coming from nativescript, but an issue with my node installation.
Run the following command sudo npm i -g nativescript
This will forcefully with security permission install the missing scripts to run the npm command again with no bugs or warnings

Private modules npm install error

After npm install in project local directory I've got log with error like this
npm ERR! code ENOLOCAL
npm ERR! Could not install from "..{path}" as it does not contain a package.json file.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/home/.npm/_logs/2018-06-28T11_13_56_437Z-debug.log
How I can resolve this problem? (the best way without deleting node-modules)