apk file with a construct two projects exported via Cordova
I open cmd then I reach to my folder with the exported project and when I try to add android using cmd - "cordova platform add android"
I get this:
'Discovered plugin "cordova-custom-config" in config.xml. Adding it to
the project Failed to restore plugin "cordova-custom-config" from
config.xml. You might need to try adding it again. Error: Failed to
fetch plugin cordova-custom-config via registry. Probably this is
either a connection problem, or plugin spec is incorrect. Check your
connection and plugin name/version/URL. Error: cmd: Command failed
with exit code 1 Error output: npm ERR! code ENOGIT npm ERR! No git
binary found in $PATH npm ERR! npm ERR! Failed using git. npm ERR!
Please check if you have git installed and in your PATH.'
Can someone help me?
do this: cordova platform rm android && cordova platform add android
Before reading and following the tutorial in NPM I installed the react-native-cli globally and it worked just fine
But in the tutorial it asks you to install sinopia
https://www.npmjs.com/package/react-native-cli
Then it gives you these instructions
react-native$ npm set registry http://localhost:4873/
react-native$ npm adduser --registry http://localhost:4873/
# Check that it worked:
react-native$ npm config list
react-native$ npm unpublish --force
react-native$ npm publish
react-native$ cd react-native-cli/
react-native-cli$ npm unpublish --force
react-native-cli$ npm publish
But the unpublish part gave me an error. the same for the 'publish' aprt.
(By the way, publish what?!)
Then it says to uninstall react-native-cli
npm uninstall -g react-native-cli
After that I couldn't reinstall react-native-cli.
It says the package is not available.
npm ERR! 404 no such package available : react-native-cli
npm ERR! 404
npm ERR! 404 'react-native-cli' is not in the npm registry.
What is this?! How can I fix it?
#edit
By the way, I don't understand why, in the Get Started tutorial it doesn't tell us how to install the react-native-cli nor gives us a link. It just states:
The React Native CLI #
Node.js comes with npm, which lets you install the React Native command line interface.
#edit2
I just managed to install react-native-cli by removing the 'registry' entry from npm config, installing it and adding Sinopia again.
I thought Sinopia worked as a proxy. If it is not found in local repository, it looks for it in NPMJS...
I even tried to install other things and I could (wdio, nodemon), I just got an error with react-native-cli.
It seems that something is wrong.
Seems like you on Windows
I don't think you need sinopia.
Tutorials was little improved on master branch of the docs: http://facebook.github.io/react-native/releases/next/docs/getting-started.html
In short:
Install node.js
Install react-native-cli: npm install react-native-cli
Install & setup Android SDK
Create & run project
react-native init AwesomeProject
cd AwesomeProject
react-native start
react-native run-android
I allready searched for solutions but couldn't find anything that works.
I'm trying to build / run apk with cordova but the emulator (and also my phone) won't start the app and fail on installation.
I tried to re-create the projet and re-install cordova but have this issue :
Error: Cannot find module
'C:\Users\...\AppData\Roaming\npm\node_modules\cordova\bin\cordova'
I also tried to do :
npm cache clean
Nothing is working, can someone help me please ?
Thank you !
I encountered the similar situation, here is the error information:
module.js:471
throw err;
^
Error: Cannot find module 'C:\Users\MYUSERNAME\AppData\Roaming\npm\node_modules\cordova\bin\cordova'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:389:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:504:3
It happened after I upgraded my cordova with the command:
npm install cordova -g
Even when I ran the "cordova" command solely, same error I could get.
Finally solved by reinstall the cordova completely :
npm uninstall cordova -g
then
npm install cordova -g
In my case solved by removing and adding platform android again
cordova platform rm android
cordova platform add android
I know, this question is kinda old but I got the same problem and I "by-pass" it with this method.
(SOLVED) Error: Cannot find module 'C:...\node_modules\cordova\bin\cordova' #3301
Actually, using ionic (Ionic CLI) : 3.20.0
first of all, check the JRE installation on your computer, if is ok, follow this steps
ionic serve
cordova clean android (or IOS)
rm -rf node_modules (just delete node_modules folder)
npm install
cordova build android (without ionic)
It will add plugins to your project and also will compile it to an APK.
EDIT:
Just create another project, copy the "src" folder to the new one and ready to go!
You just need to run these commands
npm uninstall -g cordova
npm install -g cordova#latest
Above commands are already answered but removing android and adding it again is important
and then these :
cordova platform rm android/ios/browser
cordova platform add android/ios/browser
Worked for me, hope it help others.
Follow these Steps:
npm uninstall -g cordova
npm install -g cordova#latest
I am getting -bash: react-native: command not found error while creating a react-native project.
Below are the additional info
1. brew --version
homebrew 0.9.9
2 brew info watchman
watchman `enter code here`stable 4.50
/usr/local/Cellar/watchman/4.4.0
3. brew info flow
stable 0.24.1
/usr/local/Cellar/flow/0.24.1
4. brew info node
stable 6.1.0
/usr/local/Cellar/node/6.1.0
5. npm -version
3.8.6
6. echo $PATH
/Users/Ashok/.rbenv/shims:/Users/Ashok/.rbenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
I tried the suggested steps from this link but I am still getting the same error.
I don't have any "npm" directory which they have specified in the solution
Ashoks-MacBook-Pro:share Ashok$ ls
aclocal doc info ruby-build zsh
autoconf emacs man systemtap
But I found npm file exists in the below location.
/usr/local/Cellar/node/6.1.0/etc/bash_completion.d
I uninstalled react-native and installed it again but I am still facing the same issue.
After adding right path to the PATH variable issue is resolved.
Below are the steps to find the right path.
1. Enter: npm install -g react-native-cli
output: /usr/local/Cellar/node/6.1.0/libexec/npm/bin/react-native ->/usr/local/Cellar/node/6.1.0/libexec/npm/lib/node_modules/react-native-cli/index.js/usr/local/Cellar/node/6.1.0/libexec/npm/lib
└── react-native-cli#0.2.0
from above output you can clearly see the path: /usr/local/Cellar/node/6.1.0/libexec/npm/bin/react-native
export PATH="/usr/local/Cellar/node/6.1.0/libexec/npm/bin:$PATH"
react-native init appName
cd appName
react-native run-ios
if you getting xcrun: error: unable to find utility "simctl" at this stage you can reslove using below steps
XCode -> Preferences -> Locations -> Command Line Tools -> Choose Xcode 7.2.1
You can find original solution from xcrun unable to find simctl
Thanks to #fbozo
That's It!!!
run this code
npm i -g react-native-cli
close your cmd and open it again
After continually running into this problem, and hitting this answer and not having it work..
Assuming you don't run npm as root/sudo (which you shouldn't do!) your npm modules will be installed in whatever you set your default directory to be.
Assuming you have followed those instructions, and your default directory is ~/.npm-global, then you need to add ~/.npm-global/bin to your path.
This is outlined in those instructions, but for me I added this to .bashrc:
export PATH=$PATH:$HOME/.npm-global/bin
Then restart your shell and it will work.
Try
npx react-native
if doesn't work install globally
npm i -g react-native-cli
If who have error , try it with sudo:
sudo npm install -g react-native-cli
If you're using yarn, you may have to run commands with yarn in front. Example:
yarn react-native info
I ran into this issue by being a bit silly. I use nvm to manage my different versions of node, and installed react-native into a version of node that was not my default. Upon opening a new shell, I lost my command. :) Switching back of course fixed things.
If for some strange reasons, the path to react-native is not in the PATH, you should take note where the react-native executable is installed. Generally, the issue with command not found is because they are not in PATH.
For example, I use nodenv and run npm install -g react-native
/Users/khoa/.nodenv/versions/10.10.0/bin/react-native -> /Users/khoa/.nodenv/versions/10.10.0/lib/node_modules/react-native/local-cli/wrong-react-native.js
So I need to add that to my PATH
export PATH=$HOME/.nodenv/versions/10.10.0/bin:$PATH
You can verify with echo $PATH
Or you can use npx to execute local npm modules, for example
npx react-native run-ios --simulator='iPhone X'
Install react-native globally by using the following command
npm i -g react-native-cli
Had the same issue but half of your approach didn't work for me .
i took the path the way you did :from the output of react-native-cli instal but then manually wrote in ect/pathes with:
sudo nano /etc/paths
at the end i've added the path from output then ctrl x and y to save .
Only this way worked but big thanks for the clue!
Install react-native-cli with npm install -g react-native-cli.
You may need to use sudo like sudo npm install -g react-native-cli
At first run this command on your terminal.
npm i -g react-native-cli
Then create your react-native project by this command.
React-native init Project name
then move to your project directory by cd command.
According to official documentation, the following command worked for me.
npx react-native run-android
Link is here
https://facebook.github.io/react-native/docs/getting-started
I was trying to run by "react-native run-android" command. make sure to have react-native cli installed globally!
In case anyone has this problem, I had a similar problem to qix, but more nuanced.
New shell terminals would default to a different version of node.
I would change my terminal to the node I wanted, but when the bundle script run, it ran in a new shell, and it got the default version which did not have react-native installed.
I used nvm alias default x.x.x so that new shells would inherit the default version I wanted.
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install yarn
brew install node
brew install watchman
brew tap AdoptOpenJDK/openjdk
brew cask install adoptopenjdk8
npm install -g react-native-cli
Dears,
Please try : npm install -g react-native-cli
If you get an error like Cannot find module ‘npmlog’ you can install npm directly using this command. If the above command run successfully then no need to run this command
curl -0 -L https://npmjs.org/install.sh | sudo sh
#For_Ubuntu.
Best regards.
In cmd Administration mode,Run
npm install react-native-cli
This is really weird, on my side (macOS 10.14), i'm pretty sure my node and npm work but i kept getting command not found only for this particular package. I ended up doing the following:
Install react-native-debugger
Make sure you enabled remote JS debugging, docs
Run react-native-debugger
Run your RN app
You can now debug view hierarchy and see console logs in react-native-debugger
I already had react-native and react-native-cli installed and just had to run:
yarn install
I had this issue after ejecting from expo and forgot to delete the node_modules and reinstall by running yarn or npm install.
After I did that then run npx react-native run-android, it worked fine!
try using react-native --help and see what comes up. try curl
react native library recommendation:
If you get an error like Cannot find module 'npmlog', try installing npm directly: curl -0 -L https://npmjs.org/install.sh | sudo sh.
https://facebook.github.io/react-native/docs/getting-started.html
I did an npm update, runned into the same error but after do an npm install and re-build the app worked!
Edit: This is happening when working with ionic 2. I know it's not stable yet, but i assume that there may be some fix for this, since it seems like others don't get this problem. Edit end
For some reason i've suddenly started to get this error when trying to build my ionic app, using "ionic build android", and also "ionic build ios":
An Error occurred trying to fall back to Cordova-lib execution: TypeError: Cannot read property 'then' of undefined
at Object.IonicTask.runCordova (/usr/local/lib/node_modules/ionic/lib/ionic/cordova.js:262:21)
at /usr/local/lib/node_modules/ionic/lib/ionic/cordova.js:142:19
at _fulfilled (/usr/local/lib/node_modules/ionic/node_modules/q/q.js:787:54)
at self.promiseDispatch.done (/usr/local/lib/node_modules/ionic/node_modules/q/q.js:816:30)
at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/ionic/node_modules/q/q.js:749:13)
at /usr/local/lib/node_modules/ionic/node_modules/q/q.js:557:44
at flush (/usr/local/lib/node_modules/ionic/node_modules/q/q.js:108:17)
at doNTCallback0 (node.js:430:9)
at process._tickCallback (node.js:359:13)
Error happened [TypeError: Cannot read property 'then' of undefined]
TypeError: Cannot read property 'then' of undefined
at Object.IonicTask.runCordova (/usr/local/lib/node_modules/ionic/lib/ionic/cordova.js:262:21)
at /usr/local/lib/node_modules/ionic/lib/ionic/cordova.js:142:19
at _fulfilled (/usr/local/lib/node_modules/ionic/node_modules/q/q.js:787:54)
at self.promiseDispatch.done (/usr/local/lib/node_modules/ionic/node_modules/q/q.js:816:30)
at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/ionic/node_modules/q/q.js:749:13)
at /usr/local/lib/node_modules/ionic/node_modules/q/q.js:557:44
at flush (/usr/local/lib/node_modules/ionic/node_modules/q/q.js:108:17)
at doNTCallback0 (node.js:430:9)
at process._tickCallback (node.js:359:13)
I'm lost here, and have no idea where to start looking.
Is there anyone who has seen this before, and can point me in the right direction?
#mabs #mgcdanny
I am pretty certain I've figured out the root cause to the issue. I ran cordova -v and saw this output -
Ross-MBP:test rossmartin$ cordova -v
/usr/local/lib/node_modules/cordova/node_modules/update-notifier/node_modules/configstore/index.js:53
throw err;
^
Error: EACCES: permission denied, open '/Users/rossmartin/.config/configstore/update-notifier-cordova.json'
You don't have access to this file.
I then ran
Ross-MBP:test rossmartin$ sudo chown -R rossmartin ~/.config
Ross-MBP:test rossmartin$ cordova -v
6.0.0
Now I see cordova reporting it is at 6.0.0 and can do ionic build/prepare again.
I think what happened is that the Ionic CLI did not think that the cordova CLI was installed. Maybe it is possible that somewhere the Ionic CLI does a cordova -v and was getting hung up by the permission issue reading the ~/.config/configstore/update-notifier-cordova.json file.
I had the same issue on Ubuntu.
I needed to install a few dependencies.
Firstly cordova, with:
npm install -g cordova
The Android SDK from http://developer.android.com/sdk/index.html
And a Java SDK.
uninstall globally (use sudo if needed)
sudo npm uninstall -g ionic
sudo npm uninstall -g ionic#beta
sudo npm uninstall -g cordova
fix permissions like this: https://docs.npmjs.com/getting-started/fixing-npm-permissions
this worked for me:
sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}
reinstall (without sudo)
npm install -g ionic
npm install -g ionic#beta
The build process was looking for Cordova-lib and could not find it.
This is usually caused if you have not installed Cordoval-CLI
To check if you have cordova-CLI installed, type $ ionic info
Check the result. if you see Cordova CLI: Not installed run
npm install -g cordova#4.2.0
$ ionic info > it should show Cordova CLI: 4.2.0