Can't run "npm install expo-cli --global" - react-native
I am a newbie in all this stuff. Hope for your understanding.
Let me clarify the issue:
I am trying to start react native app through expo cli. So tried to start npm install expo-cli --global to install npm globally. I got these errors:
Screen_1
Screen_2
It also says that I lack permissions to access it. How can I allow permissions?
Even when I try to start it locally I got the same issue. Your help is appreciated.
although this solution is not the best and the safest solution exists, this worked for me and that make sense because all the problem we had with the errors is the permission problems. so you can use this command and ignore those permission problems :
sudo npm install expo-cli -g --unsafe-perm
I was having the same problem with npm install -g expo-cli, having "MODULE_NOT_FOUND",
I installed yarm with brew, just in case you do not already have it:
brew install yarn
and then use:
yarn global add expo-cli
to create a project you can:
expo init nameOfTheNewProject
and choose a template in the console.
Finally run the project with
yarn start
Let me know if it works for you!
You did not mention which os. This answer working for any operating system (ubuntu in my case)
I'm also getting permission errors when running
sudo npm install --global expo-cli
Which I don't really how this can happen - as this also happens for the superuser!
For me it works when I install the client locally into the project
cd <new-project-dir>
npm init # init npm project
npm install expo-cli
Now you can use the client in this project like this:
npx expo-cli # e.g. npx expo-cli init <project-name>
npm cache clean --force
This will solve the issue
Try using npm install -g expo-cli#3.5.0 this worked for me, it may work for you.
You can try this command:
npm install -g expo-cli
or,
yarn global add expo-cli
You have to run the command as administrator from a command prompt on windows and not bash. Had me stumpt for bloody ages!
You need administrator privilege. So when you open command line interface, just right click and run as administrator
This will solve the problem
I guess, this issue comes from permission or node version , if you get this error when the node module is being refreshed ---> This is definitely a permission issue. Disable your Antiviruses or change permission manually check this as well.
First run npm cache verify, then run sudo npm install --global expo-cli.
Did work for me indeed after trying so much.
Follow the steps
First, run npm cache verify.
Open Windows PowerShell as administrator and run npm install expo-cli
--global --no-optional command.
npm cache clean --force then npm install --unsafe-perm -g expo-cli
It is likely you do not have the permissions to access this file as the current user.
The best way to solve this problem is to reinstall npm with a node version manager.And you don't need to remove your current version.
About node version manager
use nvm or n with OSX or Linux
use nodist or nvm-windows with windows
Upgrade Node version to +10
Then do
sudo npm install expo-cli -g
This worked for me. I hope this would solve your problem!
sudo npm install expo-cli -g --unsafe-perm=true --allow-root
If any of the solutions above result in success, please follow the steps below:
Uninstall Node.js
Restart your pc/mac
Download latest version of the Node.js (https://nodejs.org/en/)
Open cmd as admin mode or use "sudo" before the command line on Mac.
npm install expo-cli --global
I hope it can help
In my case, I deleted two files then everything worked. The two files are in this path: C:\Users\{Username}\AppData\Roaming\npm under the names 'expo.ps1' and 'expo-cli.ps1'
Then run:
npm i -g expo-cli
re-install node.js, it works for me
First update Node.js to the latest stable version and then again try to install expo ad clean before expo folders that are being created in below location
C:\Users\{{computer_username}}\AppData\Roaming\npm
If it's throwing error in visual studio code, try from cmd, was facing same error but solved through this way
npm install -g expo-cli
try going into windows resource monitor and terminating adb.exe (android resource bridge). This worked for me after searching for solutions for days. I tried this after verifying cache, clearing cache, you name it.
As a Debian 10 buster user I got the same permission error while using this command: sudo npm install expo-cli --global.
The problem was solved by installing expo-cli with yarn package manager and the command below: sudo yarn global add expo-cli.
For Windows User :-
Open your Powershell and type:
npm install expo-cli --global
This worked for me after trying and reasearching for hours.
Note:Don't Use cmd or any other terminal and also don't type npm install expo-cli -g as it is written in the react native docs. It would always show up an npm error.
For windows
Follow these steps carefully
open the command prompt and run it as administrator.
recommended npm uninstall --global expo-cli.
run the command npm cache clean --force.
run the command npm cache verify .
now run the command npm install --global expo-cli
dont run command like npm i -g expo-cli or npm install -g expo-cli.
7.Make sure you run the command mentioned in the 4th step ONLY.
thankyou.
I had this problem in Windows 10, to be able to install the latest version (I had no choice since it broke the current one). I had to install the latest version of Python (3.8.0) and then run npm install --global --production windows-build-tools as an administrator, then I was able to run again: npm install expo-cli --global to install the version 3.8.0 of the expo-cli
Here is the solution and 100% working. I am working with Windows and not sure abut Linux.
Open cmd and
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
then press yes
Now run the command to start your project
npm install -g expo-cli
I had previously removed Expo from my Windows machine and encountered this error whilst trying to reinstall. Reading the error message solved the problem.
npm i expo-cli -g --legacy-peer-deps
Using this command in 'PowerShell' installed expo successfully.
If anyone else has this problem here is my fix, go to Finder, in the input field (search box) type in /usr/local/lib then press CMD + SHIFT + G press the OK button or whatever pops up, then CMD + SHIFT + . and delete the NVM file i deleted the expo folder too. Then go to this link https://changelog.com/posts/install-node-js-with-homebrew-on-os-x
follow the instructions and install brew, node, etc. Last step go to your terminal and type sudo npm install expo-cli --global
First: I upgraded my mac version 10.13 to 10.15
Then I downloaded homebrew, Watchman, Git and Node.js
Finally I ran this command sudo npm install --global expo-cli --legacy-peer-deps
If you have any further questions check the docs out: https://docs.expo.dev/get-started/installation/
Sometime, I use npm not work.
I try a lots times run with npm but fail for expo cli.
Please try yarn global add expo-cli
It wills save your time ^^.
I was trying to install expo-cli with my company npm registry configured.
I've created 2 differents profiles using npmrc and using the profile with https://registry.npmjs.org/ solved the issue.
Related
Can't remove Expo-cli
For some reasons I can't update or remove my version of Expo-cli. I'm stuck on the 3.11.7 version. When I launch the update, it ends correctly but without being taken into account. I've tested all the methods I've found but I haven't been able to uninstall it yet. When I launch my project, it continues to launch normally with the v.3.11.7. here are the commands line i already try : yarn global remove expo-cli npm -g uninstall expo-cli --save sudo apt-get --purge remove expo-cli yarn uninstall expo-cli the expo --version commands is not working anymore ... I need help please. screenShot of the update request:
Please confirm OS. Mine is Windows 10. Look in appdata for yarn or npm install directories. You can find the globally installed package files and delete expo. Essentially an npm or yarn version other than the one you're using has installed the expo-cli and now your current version can't find it. I solved this by deleting the expo files in that dir
Had the same problem. Here's how I decided it ( Win 10 ) Open cmd as administrator and type npm cache verify After that type npm -g uninstall expo-cli --save, if it freezing terminate it. Remove from your user folder ".expo" folder. Than try npm -g uninstall expo-cli --save in cmd, if it freezing terminate it and open some expo project. type yarn remove global expo-cli and then yarn add global expo-cli in the project Hope it helps somebody else too.
How to fix Something went wrong installing the "sharp" module and Cannot find module '../build/Release/sharp.node' in expo
I tried to install expo after I executed the command exp start but I got: Something went wrong installing the "sharp" module Cannot find module '../build/Release/sharp.node'. How can I fix this problem?
I had the same problem and this single line command did the trick. npm rebuild --verbose sharp Consult the installation documentation at Common problems.
Find the latest version of sharp and install it. npm install sharp#0.28.3 --save This worked for me.
I am not using expo but faced this issue in react native. All I did is "deleted node_modules/sharp" folder. run npm install. fixed the issue.
Maybe you configured npm to ignore installation scripts. In that case delete the sharp module and run: npm install --ignore-scripts=false
This causes after i updated, npm,angular version. just try npm i cordova-res it solves above problem.
I was facing same issue in mac when I update my developer tools using xcode-select install then node project stop working on local sudo rm -rf /usr/local/Cellar/python3.8 sudo rm -rf /usr/local/Cellar/python3.9 rm yarn.lock rm package-lock.json rm -rf node_modules brew upgrade yarn install worked for me
If anyone has this problem and other solutions didn't solve it. Try to uninstall vips globally, it worked for me. npm -g uninstall libvips brew uninstall vips Then: yarn clean yarn install gatsby develop
if trying some quick command fixes don't work you can try rebuilding the node_modules. Delete the whole node_modules folder and run npm install npm install
Upgrading of gatsby-transformer-sharp helped me in my case.
You may need to completely reinstall expo-cli package. yarn global remove expo-cli yarn global add expo-cli OR npm uninstall expo-cli -g npm install expo-cli -g (If you don't have expo-cli installed globally, remove global / -f flags)
npm install -g not working while uninstalling react-native-cli?
I am trying to uninstall the "react-native-cli" which I use for react-native projects! but I am not able to do so! My environment is mac. Here is what i have done so far! Whether I type npm uninstall -g react-native-cli or sudo npm uninstall -g react-native-cli. The terminal shows: up to date in 0.041s When I type react-native init projectName, it still creates the project. I think the command react-native init should not to work. Anyone knows how to uninstall react-native-cli ? Thanks in advance.
SOLUTION ONE ! not fully sure this will work! but try updating your npm first by doing npm install npm and after that try uninstalling the cli if that does not work then SOLUTION TWO ! Here is another go around to solve the issue its a bit manual way 1: First run this npm list -g this will show the list of installed packages in your user folder then check . using command+f if there is react-native-cil there then do this open /usr/local/lib/node_modules This will open the root installed packages and you can manually find and delete the react-native-cli like this
If you are using yarn. You can do yarn global list then check that if any package contains react-native. Then run yarn global remove <package> to remove that package. ex: yarn global remove #react-native-community/cli
You can uninstall react native CLI using: npm uninstall -g react-native-cli
'react-native' is not recognized as an internal or external command, operable program or batch file
I recently started with react-native. I install it using the tutorial on the Facebook site and everything works well for a day or two until this message comes up: 'react-native' is not recognized as an internal or external command, operable program or batch file. Nothing works except uninstalling everything and starting all over again. The environments are ok and work (npm, choco, etc.). I have also tried removing and adding react-native to environment variables, restarting, and running cmd in administrator mode, but nothing so far. I should add that I use windows 10 64-bit.
I had the same issue and tried the following but didnt work Adding npm path to my Environment variables; both system and user Re install npm and react-native-cli Both didn't work for me, im using Windows 10; Solution that worked for me is to install react-native-cli globally You can install it globally by using the below command: npm install -g react-native-cli
You can simply use npx react-native <command> it will work
npm install -g react-native-cli But dont forget to restart command promprt
Your system or user environment PATH variable was edited, you can uninstall NodeJs and install it again or add the below path to the end of PATH variable into user variables the restart the Windows : C:\Users\[USER-NAME]\AppData\Roaming\npm this should work.
You need to setup the npm path in your environment variables. Please look at the images down below Then follow the command : for installing -g ( global ) for cli in your system npm install -g react-native-cli
I get the same error right off the bat on Windows 10 running in cmd window in adminstrator mode, however there is also a bash shell version of react-native that worked for me in a git bash window. cmd:---------------------------------------------- C:\Users\David\Documents\react>where react-native C:\Users\David\AppData\Roaming\npm\react-native C:\Users\David\AppData\Roaming\npm\react-native.cmd C:\Users\David\Documents\react>react-native init AwesomeProject 'react-native' is not recognized as an internal or external command, operable program or batch file. git bash:---------------------------------------- David#CYBER-PC ~/Documents/react $ react-native init AwesomeProject This will walk you through creating a new React Native project in c:\Users\David\Documents\react\AwesomeProject Installing react-native package from npm... Setting up new React Native app in c:\Users\David\Documents\react\AwesomeProject AwesomeProject#0.0.1 c:\Users\David\Documents\react\AwesomeProject`-- react#15.3.1 To run your app on iOS: cd c:\Users\David\Documents\react\AwesomeProject react-native run-ios - or - Open c:\Users\David\Documents\react\AwesomeProject\ios\AwesomeProject.xcodeproj in Xcode Hit the Run button To run your app on Android: Have an Android emulator running (quickest way to get started), or a device connected cd c:\Users\David\Documents\react\AwesomeProject react-native run-android
npm install -g react-native-cli
I had to add the %APPDATA%\npm folder to my PATH on Windows 10. Global modules are installed there.
If uninstalling and installing again the npm did not work on you, try adding %APPDATA%\npm to path (Environment variables) then quick reboot/restart. System Reboot should really be part of the process. This worked on my end. Install : npm install -g react-native-cli Uninstall : npm uninstall -g react-native-cli
If you are following the getting started guide for Windows/Android, they recommend installing nodejs via Chocolatey. But Chocolatey likes to have administrator rights when it installs things. If you're just a regular user, this seems to interfere with how npm installs react-native-cli. In my case, the react-native command was only recognized when I launched a command prompt as admin. What I did to fix: launched command prompt as admin uninstalled react-native-cli globally: npm uninstall -g react-native-cli uninstalled nodejs via Chocolatey: choco uninstall nodejs Now, as a regular user without admin rights: installed nodejs via the nodejs website (not Chocolatey) installed react-native-cli globally: npm install -g react-native-cli
I uninstalled node.js and then reinstalled it, and it worked like a charm
just uninstall the node.js and reinstall it.. then install the cli package typing command npm install -g react-native-cli.. now you are ready to make your project. To make project open a folder from your drive wherever your folder is located. Then type command react-native init albums it will create a project for you inside your directory.
None of the above mentioned solutions worked for me. What did work was to remove nodejs, and reinstall it via Chocolatey with the following command: PS > choco install -y nodejs.install python2 jdk8 > npm install -g react-native-cli C:\Users\user\AppData\Roaming\npm\react-native -> C:\Users\user\AppData\Roaming\npm\node_modules\react-native-cli\index.js + react-native-cli#2.0.1 added 41 packages from 15 contributors in 4.528s
I had this problem also becuase I restored my files from a previous OS installation. My problem was a wrong prefix in my C:\Users\user_name\.npmrc file. Run npm config list and make sure that all your npm config variables are leading to the correct file paths. Delete the .npmrc file if you want have it to go back to the defaults. That's what I did and react-native command is working for me again. I hope this helps.
i have no clear idea but below steps worked for me. delete Node Modules Uninstall react-native cli. This is Recommended in the react-native Documentation "If you previously installed a global react-native-cli package, please remove it as it may cause unexpected issues." npm uninstall -g react-native-cli clean gradlew. in your project folder, go to the android folder by typing cd android and run gradlew clean move back to your project folder cd .., then run npx react-native run-android these steps worked for me. took some time when running first time.
use node.js stable version or recommended version.
On window 10, nodejs>11 global node libraries seems to be installed in C:\Users\your_user_name.npm-global. So you need to set the variable to point to that path
I had problems because of this strange mistake. I checked to see if it was globally loaded again I didn't delete all packages I even deleted C:\Users[USER-NAME]\AppData\Roaming\ npm manually, but there was no solution. The only thing that is the solution is to use the current version of node.js.
uninstall nodejs completely(restart your pc) and reinstall it using chocolatey and follow other commands from https://facebook.github.io/react-native/docs/getting-started. worked perfectly fine for me!
Even if you have installed react-native globally and still get the same try adding path of npm module (C:\Users\your user name\AppData\Roaming\npm) to system variables instead of user variables.
I know it's too late, anyway Make sure you've added the path of the NPM in system variable rather than user variable in the System Environment Variables. PATH : C:\Users\user_name\AppData\Roaming\npm
Open a the command prompt and type: npm config list: Get the path underlined in red and add it your system path (change two back slashes into one), for example: C:\Users\YOURNAME\AppData\Roaming\npm. This solved the issue for me
I just wrote "react-native -v" to console to check have I still react-native and then just I wrote "react-native run-android" again and this time it worked. Yes just that. React native is terrible technology.
Looks like I have uninstalled react native cli by mistake, I tried all answers mentioned above, but the below command worked for me. npx react-native run-android.
Solution I was facing 'react-native' is not recognized as an internal or external command,operable program or batch file error when I was running react-native start in VsCode. I Solved it by running npm install -g react-native-cli in PowerShell Steps to follow run PowerShell as admin (important step) run running npm install -g react-native-cli in PowerShell close VsCode and rerun it that's all!
I solve this problem by running npm install -g react-native-cli then another error appears Command run-android unrecognized. I fixed this error by npm install
Use npx before your command npx react-native Not just react-native
if you faced the same issue as me just type : npm i react-native then try to create a new project as its recommended by the react native doc by typing : npx react-native init yourProjectName this should resolve your problem hope this was helpful
Cannot install ionic using npm
Please check the below image and give a solution for this, I am stuck, please help.
Finally was able to fix the issue and install ionic, so I was hoping I should share it, if anyone having the same issue please check if my steps also works for you. Turn off Windows Firewall Turn off any/every Antivirus or windows defender you are running. Clear npm cache, run - $ npm cache clean Remove Nodejs Restart PC Install latest version of Nodejs Clear npm cache again, run - $ npm cache clean [important] First only install cordova, run - $ npm install -g cordova Then install Ionic, run - $ npm install -g ionic Hopefully it will work, this how I was able to fix my issue.
You have to install Node JS 0.12.6 Version, and after that, use: $npm install -g cordova ionic in DOS (cmd). It will install ionic and Cordova.