Phonegap create project error - "module not found" - node.js

I have installed node.js(node-v4.2.3-x64) in my windows system. I followed the exact tutorial on getting started in phonegap website. The nodejs installed successfully and when I create new project using phonegap create my-app, It shows module not found error. I have attached screenshot for reference. Kindly help me..

Try doing npm install first, and then run phonegap create my-app.
You don't need to do npm install everytime you create a new one, just the first time because that installs any and all the packages that nodejs requires but can't find.
Also if that does not work try doing npm install cordova -g and npm install phonegap -g.

Related

starting react native app

I'm starting work on React Native, using create-reactive-native-app and Exponent. There is a nice list of open source examples here, some of then are mentioned to use Exponent.
https://github.com/ReactNativeNews/React-Native-Apps
I have few experience with nodejs. I already noticed there are several possible configurations for React Native apps. I usually use npm start to run it, but that don't work on those examples, since since they don't have a start script in package.json.
Take as an example the native-component-list app. How can I execute it after cloning and doing npm install?
Using node v6.11.4 and npm 3.10.10
I also tried using react-native run-android . It works when I create a new project with react-native init Ola2
But not with the downloaded code.
Here are some more details. I did this before: npm install -g react-native-cli
npm install
react-native run-android
Scanning folders for symlinks in xxx/native-component-list/node_modules (25ms)
Android project not found. Maybe run react-native android first?
react-native android
Scanning folders for symlinks in xxx/native-component-list/node_modules (26ms)
Unrecognized command 'android'
Run react-native --help to see list of all available commands
As per this link, you can run the app with command react-native run-android (for android)
I found the problem. I just had never used Expo.io way to create a ReactNative app. I only knew the init and the crna ways. This apps where created with the exp tool.
So,to run it, just do:
npm install exp --global
npm install
exp android
exp start
I didn't work on Expo, I prefer react-native-cli
In your case, your project in developed on Expo.
So you need expo-cli to run the project.
For Expo Cli
npm install -g expo-cli
For CRNA
npm i -g create-react-native-app
Internally CRNA use EXPO, so you can choose any option. After installing the expo-cli npm start command work fine for you.
Or you can eject this project.
You can run npm run eject to get a project very similar to what react-native init would generate. At that point you’ll need Xcode and/or Android Studio just as you would if you started with react-native init , adding libraries with react-native link will work, and you’ll have full control over the native code compilation process.
Hope it will work for you.

React-native removed when use npm install

I don't understand why my npm make that and i'm new with react-native.
Here is the description of my "bug" on Windows 10 :
I can use react-native command for run android or create react-native app like that react-native init TestApp
When i go into my app folder with cd TestApp and i run react-native link or other react-native command everythings work fine.
But if i install a new package like fbsdk with npm like that npm install react-native-fbsdk --save i saw after installation this message :
added 1 package and removed 639 packages in 22.207s
And after that, if i would like use react-native command i have this message :
Command link unrecognized. Make sure that you have run npm install and that you are inside a react-native project.
For this message, i have entered react-native link command.
You know why npm remove all my packages ?
I got the same problem.
However I solved the problem by deleting the package-lock.json and then running npm install.
Check the answer here.
I also noticed recently that npm install doesn't do what I expect, but that may be because I'm newbie.
However yarn install is a good replacement and is working fine for me. I used it to upgrade/downgrade things by directly editing packages.json, and it also solved the npm link problem that I faced.
Edit: downgrading to npm 7 solved all my issues

Couldn't find ionic.config.json file. Are you in an Ionic project?

I am new to Ionic and trying to run ionic serve to test my application but I keep getting this error:
Couldn't find ionic.config.json file. Are you in an Ionic project?
On running ionic info, I get the following:
$ ionic info
******************************************************
Dependency warning - for the CLI to run correctly,
it is highly recommended to install/upgrade the following:
Please update your Cordova CLI to version >=4.2.0 `npm install -g cordova`
******************************************************
Your system information:
Cordova CLI: undefined
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.1.7
OS: Windows 7
Node Version: v4.4.5
Tried it with Couldn't find ionic.config.json file but couldn't resolve the issue.
I am also getting this trace while creating an application with ionic start myApp tabs:
Installing npm packages (may take a minute or two)...
Error with start Error: spawn UNKNOWN
at exports._errnoException (util.js:870:11)
at ChildProcess.spawn (internal/child_process.js:298:11)
at Object.exports.spawn (child_process.js:362:9)
at spawn (C:\Users\user\AppData\Roaming\npm\node_modules\ionic\node_modules\ ionic-app-lib\node_modules\cross-spawn\index.js:17:18)
at Object.runSpawnCommand (C:\Users\user\AppData\Roaming\npm\node_modules\io nic\node_modules\ionic-app-lib\lib\start.js:56:17)
at C:\Users\user\AppData\Roaming\npm\node_modules\ionic\node_modules\ionic-a pp-lib\lib\start.js:104:20
at _fulfilled (C:\Users\user\AppData\Roaming\npm\node_modules\ionic\node_mod ules\q\q.js:787:54)
at self.promiseDispatch.done (C:\Users\user\AppData\Roaming\npm\node_modules \ionic\node_modules\q\q.js:816:30)
at Promise.promise.promiseDispatch (C:\Users\user\AppData\Roaming\npm\node_m odules\ionic\node_modules\q\q.js:749:13)
at C:\Users\user\AppData\Roaming\npm\node_modules\ionic\node_modules\q\q.js: 557:44
Can someone please help here.
I think your first machine have ionic version < 2.0.0, the other one >= 2.0.0
If you found file named
ionic.project rename it to ionic.config.json
Hope this will help you.
Create an ionic.config.json file manually in your project folder. Copy below mentioned code in this file:
{
"name": "Replace with your project name",
"app_id": "",
"v2": true,
"typescript": true
}
perform an npm install to ensure all node_modules are updated. This worked for me
After creating your new project, you need to step into the projects folder, in there you will find the config file and you can run ionic serve.
$ ionic start myApp tabs
$ cd myApp
$ ionic serve
Be sure that you are running last version of ionic and cordova.
install ionic using.
npm install -g ionic#latest
or
refer link : http://ionicframework.com/docs/guide/installation.html
As per logs you are getting Cordova CLI: undefined. Seems like an issue with CLI installation. Try reinstalling and that should solve your problem.
I would suggest you to start the fresh installation. And remove existing cordova and ionic
install cordova & ionic with npm install -g cordova ionic
Then install the template ionic start --v2 myApp tabs
Check out this link https://ionicframework.com/getting-started/
I had the same issue here is what I did.
Mac steps
sudo npm install npm -g
sudo npm install -g cordova
Restart your computer also. I was receiving deprecated minimatch#2.0.10 warnings prior to the restart.
Windows steps
Redownload Node.js by going to here
After download npm and Node.js will be updated as they are packaged together in the download.
sudo npm install -g cordova in Command prompt window.
Run cordova --version to make sure you are all set
Restart your computer.
This should resolve the issue hopefully.
I tried this and i was able to resolve my own issue with the ionic.config.json file. Try to update your graceful-fs file by running this command:
npm install -g graceful-fs graceful-fs#latest.
After running the command, try to create your project again by running the ionic start myApp. Where 'myApp is the name of the folder you want created for your project. This should work for you.
Make sure your node version is above v6. Then in the root of your ionic project run ionic info.
It should give you a prompt something like "Looks like this is an Ionic Angular project, would you like to install #ionic/cli-plugin-ionic-angular and continue?"
Type yes
It should have ran the following command for you: npm install --save-dev --save-exact #ionic/cli-plugin-ionic-angular#latest
Now you can run ionic serve and it will work.
p.s above is from my experience, had the same issue and the above sorted it out. Hope this is useful.
Check if you are not in project directory and try
ionic serve
And If you found file named ionic.project rename it to ionic.config.json

install cordova failed with node.js command prompt

what is my problem? is it successfully installed or failed? It doesn't seem right for me.
Cordova was installed successfully. You are looking at the dependency tree, so don't worry.
Bear in mind that you have installed the CLI tools. You have to actually create a cordova project with the command before you will see a cordova project.
cordova create <Your project name>

npm -g adds package to C:\usr\local instead of C:\Users\{User}\AppData\Roaming\npm

I'm trying to working with ionic framework but i get stuck when install ionic via npm
npm install -g ionic
I try $ ionic but it always show "ionic is not recognized as an internal or external command" error.
Then I found that ionic was added into C:\usr\local instead of C:\Users{User}\AppData\Roaming\npm.
I's using Windows 8.1 and I also add C:\Users{User}\AppData\Roaming\npm into PATH and restart machine.
Please help me.
I can temporally fix this issue by copy all folders , files in C:\usr\local instead and paste into C:\Users{User}\AppData\Roaming\npm.
But I still wonder why I get this issue.
Thanks guys.

Resources