I am using Ionic 3. Right now I'm trying to do ionic cordova build android , but I get TypeError: env.runcmd is not a function (please see the photo attached).
I tried to:
-> ionic cordova platform rm android then ionic cordova platform add android then again build android again
-> delete node_modules folder and do npm install then build android again
But none of them helped it...
My ionic info output:
Just use command 'cordova run android' instead of 'ionic cordova run android'.
Okay, guys, the problem was exactly with cordova version. I haven't noticed when it did update to the version 7.0.1. However, I had to downgrade it to version 6.5.0 and then android build succeeded.
The only thing that confused me was the downgrade process. Every time I did sudo npm uninstall cordova -g, the cordova command was still available at bash. If I would do sudo npm install cordova#6.5.0 -g, the version still remained 7.0.1. Even some other commands such as ... --save --save-exact ... did NOT work.
So below are the steps which I've gone through to solve this issue (I am using Ubuntu linux, so this will work for linux users only).
First I uninstalled cordova through npm
sudo npm uninstall cordova -g
Then removed the program from local bin
sudo rm /usr/local/bin/cordova
Installed the specific version of cordova
sudo npm install cordova#6.5.0 -g (or whatever version you want)
And lastly, I have to admit that after cordova installation, it was now located at /usr/bin/cordova, no more at /usr/local/bin/cordova, so I had to create a hard link to it.
sudo ln -s /usr/local/bin/cordova /usr/bin/cordova
Voilà!
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!
Iam an automation tester having good experience in selenium automation tool and other tools.Now i want to implement mobile automation so i choose appium and started to install but faced number of issues and saw the same issues in several blog to rectify but couldnot.Kindly help me and below is the installation which i followed
1.Installed android sdk.
2.I just followed the instruction in the site http://appium.io/
brew install node # get node.js
npm install -g appium # get appium
npm install wd # get appium client
appium & # start appium
node your-appium-test.js
Now which brew gives me /home/user1/.linuxbrew/bin/brew ,
npm install -g appium but this gives me "Please try running this command again as root/Administrator."
Then i installed nvm then npm to solve this issue but again the same above error.I tried my best but i couldn’t.Can any one help pls.
Below are the configurations
Os:Ubuntu
Mobile Os:Android
Thanks a lot
This sounds like permissions issue with .npm folder in home directory that I faced also. Try following:
Make sure you installed node via homebrew (this will allow you to install Appium to a home directory without sudo). Do not install node via apt. Use brew list to check if node installed via brew.
Fix permissions issues with .npm folder (thanks for this answer): sudo chown -R $(whoami) ~/.npm
Install Appium with: npm install -g appium
Titanium SDK will not recognize Titanium CLI, node, alloy, or npm on Ubuntu 12.04
I followed the installation instructions for the Titanium SDK here: http://docs.appcelerator.com/titanium/latest/#!/guide/Quick_Start
Each time I try to launch titanium, it prompts me for some Titanium Updates.
But of course, when I click the fancy update button, it tells me:
'Installing Titanium Updates...' has encountered a problem. Error
encountered during update.
Cannot install Node on platforms other than Windows or Mac.
NPM is not installed.
NPM is not installed.
NPM is not installed.
I disagree: I have definitely installed node, npm, and I manually installed alloy with
npm install -g alloy
Here are some other relevant results from my terminal:
ryan#Grisbuntu:~$ which node
/home/ryan/local/bin/node
ryan#Grisbuntu:~$ which titanium
/home/ryan/local/bin/titanium
ryan#Grisbuntu:~/local/bin$ titanium -v
3.1.2
ryan#Grisbuntu:~/local/bin$ node -v
v0.10.15
ryan#Grisbuntu:~/local/bin$ alloy -v
1.2.2
ryan#Grisbuntu:~/local/bin$ npm -v
1.3.5
I'd like to continue with a "Hello World" application (and beyond), but for example when I click "Run->Android Emulator", I get the following error:
'Launching Titanium Android Emulator - html5-hello' has encountered a
problem.
Unable to locate the CLI executable. Please restart Studio or use
Help > Check for Titanium Updates to install Titanium CLI.
I have discovered quite a few similar questions out there, but few answers... can anyone give me a clue as to how to fix this? I am new to Titanium/Eclipse: Is there a simple path setting that I am missing somewhere?
I think I fixed my own problem. Despite the fact that node and npm were previously installed on my system, and I was able to do things like "node -v" and "titanium -v" from a "normal" linux terminal, Titanium was not recognizing the existence of any of these programs. I tried various combinations of inserting an export statement into my bash profile, uninstalling and reinstalling node, (via apt-get and manually extracting the tarball, etc) and so on, but nothing seemed to work.
What I ended up doing was launching my Titanium project, and I ran "node -v". It gave me version 0.6.blah.blah. I am still confused why this is... but to solve it, using the terminal WITHIN titanium, I issued all the following commands:
(before I go on, if you're going to try this yourself, this answer might be incomplete or slightly inaccurate: i'm sorry that I didn't write it down exactly as i went... but this is close. The point to this solution is that I had to do it FROM WITHIN titanium).
sudo apt-get remove npm
sudo apt-get remove node
wget http://nodejs.org/dist/v0.10.18/node-v0.10.18.tar.gz
tar -zxf node-v0.10.18.tar.gz
cd node-v0.10.18
./configure && make && sudo make install
RESTART TITANIUM
then, again in a titanium terminal, run
npm install titanium
npm install alloy
Those last 2 commands are what really got me over the hump. My hello world application, and my android emulator, now successfully launch. Hope that helps someone. If anyone can explain to me why I had to do it this way, I'd like to understand it. Otherwise, thanks & good luck!