Cordova project is not getting created - node.js

I am using mac os yosemite. After installing cordova, I was trying to create project using
cordova create hello com.example.hello HelloWorld
My command get stuct at some point and showing
Downloading cordova library for www...
Then I uninstalled cordova and updated npm using
sudo npm update npm -g
after update I again installed cordova. This time it get instaled with one warning.
npm WARN engine npm#1.4.28: wanted: {"node":">=0.8","npm":"1"} (current: {"node":"0.10.13","npm":"2.1.18"})
But I am still unable to create project it is still stuck at the same point (i.e. Downloading cordova library for www...)
I really don't know what to do in this.
My npm version is 2.1.18.
Any help?

Related

ERROR An error occurred while running npm i (exit code 1): Ionic Error

I followed this tutorial:
1.Node installed - node-v8.9.0-x86
2. ran command npm install -g cordova ionic
npm WARN deprecated node-uuid#1.4.8: Use uuid module instead
C:\Users\Android1\AppData\Roaming\npm\cordova ->
C:\Users\Android1\AppData\Roaming\npm\node_modules\cordova\bin\cordova
C:\Users\Android1\AppData\Roaming\npm\ionic ->
C:\Users\Android1\AppData\Roaming\npm\node_modules\ionic\bin\ionic
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.1.2
(node_modules\ionic\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for
fsevents#1.1.2: wanted {"os":"darwin","arch":"any"} (current:
{"os":"win32","arch":"ia32"})
+ cordova#7.1.0
+ ionic#3.16.0
added 115 packages and updated 2 packages in 69.815s
Then ran command ionic start myApp tabs , got following Error
Thank you,
After spending more than day i came across many solutions, which are as follow
Some developers solve this problem by,
i downgraded node from v8 to v7.6.0 and all seems to work fine with ionic CLI. From Here but this solution not work for me.
Run Command Line as Administrative, this solution is beneficial
The Correct and well solution work for me, is to install install all node-gyp dependencies
by following command
$ npm install --global --production windows-build-tools
and then install the package
$ npm install --global node-gyp
Solution Link
npm cache clean --force
This command worked for me.
Solution:
step 1 : sudo -s
step 2 : sudo ionic start todo blank ( for ubuntu )
I also face the same problem.
Solution is worked for me in Ubuntu 16.04:
sudo -s
First Get Access of Super User from Above Command
sudo ionic start myApp tabs
After Get into SUDO Mode, then run ionic command with sudo, like above
Thanks
Please follow the simple procedure to solve this issue:
Delete
(1)npm and
(2)npm-cache
folders manually. [You can find it in => %AppData%/npm-cache on Windows.]
Uninstall the Node.Js application in Programs and Features in Windows-OS.
Restart the System.
Once again re-install Node.Js in your system, perfectly.
open terminal anywhere (preferably from Desktop) and run
node --version
and check it is latest version.
Run
npm --version
and check it is latest version.
Run
git--version
and check it is latest version.
Run
npm install -g ionic
Finally Run,
ionic start myApp tabs
Here ==>>wait for more time (8-10 mins)<<== until all the ionic files to be downloaded, install and create a new ionic app in the given name.
Finally, a new ionic project will be created.
Go to the project folder of that particular ionic project and Run
ionic serve
The project will run in Browser.
All the best, Devs ..!!!
I was facing same problem. So, I installed my node module using yarn instead of npm. And it worked for me. Try it using [Yarn][1]
You can try it and check.
Thank You.
Solution:
step 1 : sudo -s
step 2 : sudo ionic start todo blank ( for ubuntu )
Try running 'npm i' command in the project directory in sudo mode or administrator mode. This worked for me.
The solution is
** Clear npm cache
**Delete package-lock.json file from your proyect
** Access your proyect
** Run yarn install
**You may have problems with your internet conection
I started using react instead of angular and the error was gone.
My WSL machine has a problem detecting which gradlew process to run so I had to manually add '.bat' extension here:

Ionic start give error: There was an error with the spawned command: npminstall

I'm trying to create a mobile app with ionic and cordova but when I launch the comand
ionic start {{appname}} blank
after the download npm give me
Error with start undefined
Error Initializing app: There was an error with the spawned command: npminstall
There was an error with the spawned command: npminstall
I can see that the download is completed because I can see the generated folders. I followed all the suggest I found on the web like update node and npm but nothing works.
Here are the version of npm, node, cordova and ionic
ionic 2.2.1
cordova 6.5.0
npm 4.4.1
node 6.10.0
Other little warning:
I don't know why after all the upgrade when i launch
ionic -v
I've got this:
******************************************************
Dependency warning - for the CLI to run correctly,
it is highly recommended to install/upgrade the following:
Please install your Cordova CLI to version >=4.2.0 `npm install -g cordova`
******************************************************
2.2.1
even if the cordova version is > 4.2.0 but I really don't think that this is the primary problem. Any ideas?
EDIT:
I'm working on windows 7
I found the solution!
I tried to lunch the command
ionic start app blank --verbose
and as before it stopped at npminstall. The problem were that verbose doesn't told me the real problem.
I moved inside the folder downloaded by Ionic and I launch
npm install --verbose
and here he told me that the problem were the https proxy configuration.
So if the error gave by Ionic is just
There was an error with the spawned command: npminstall
just go inside the downloaded folder and launch
npm install --verbose
for check the real problem
Uninstall all (ionic, cordova, nodejs).
Install nodejs LTS version using this URL - https://nodejs.org/en/
Install ionic and cordova using this URL - https://ionicframework.com/docs/v2/intro/installation/
Also Reinstall Git and when it asks Adjusting your PATH environment select Use Git from the Windows Command Prompt.
When You install ionic and cordova open cmd as admin.
Then Run command in ionic start myApp blank --v2
I figured how to solve the dependency warning problem
cordova -v
and then you get a question like :
May Cordova anonymously report usage statistics to improve the tool over time?
say yes.then fixed warning problem.
then install npm globally
npm install -g npm
create a app without installing its packages
ionic start app --v2 --skip-npm
seems ok till now?then
cd app
install packages
npm install --save
done!try to start your ionic app
ionic serve

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 Apache Cordova on Archlinux

I installed it with
yaourt nodejs-cordova
I have the following settings:
node -v
v5.0.0
npm -v
3.3.10
which node
/usr/bin/node
which npm
/usr/bin/npm
Now I tried this:
sudo npm install -g cordova
But as result I get this:
npm WARN engine xmlbuilder#2.2.1: wanted: {"node":"0.8.x || 0.10.x"} (current: {"node":"5.0.0","npm":"3.3.10"})
/usr/bin/cordova -> /usr/lib/node_modules/cordova/bin/cordova
/usr/lib
└── cordova#5.3.3
Is it a version problem?
Can anyone help me?
Because now, when trying to create a new project I get this:
Creating a new cordova project.
Could not find directory: /usr/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/cordova-app-hello-world
It's hard to say with the output you've shown, but there is some dependency of cordova that is depending on an outdated version of xmlbuilder.
Newer versions of xmlbuilder use a different node version compatibility specifier:
"engines": {
"node": ">=0.8.0"
},
This makes it compatible with newer versions of node.js (including v5.0.0).
EDIT:
Here is the dependency tree for cordova. In there we see that the problematic dependency link goes like cordova#5.3.3 -> cordova-lib#5.3.3 -> plist#1.1.0 -> xmlbuilder#2.2.1. So then looking at each project in the chain, it's evident that several things need to happen:
An issue needs to be created at the plist issue tracker telling them to publish a new version because they already have their package.json pointing to the newer xmlbuilder with the fixed engines list.
After that is done, an issue needs to be created on the cordova issue tracker (requires a JIRA account there) telling them to update their dependency to use the newly published plist.
I found the solution on this site: https://ervinloh.wordpress.com/2015/06/07/solving-npm-warn-engine-cordova-js3-8-0-wanted-warning/
It is possible to force npm to install the newest Cordova version with:
npm install -g cordova#4
Doing this, everything works fine.

Phonegap installation failure. Sticking to version 0.9.4 by default

Ive been trying to install phonegap for hours now. For some reason by default it installs version 0.9.4 (when I do npm install -g phonegap). If I specify to use latest version (npm install -g phonegap#5.0.0-0.28.1) I get tonns of errors for almost every dependency out there. Tried reinstalling node, removing modules, clearing npm cache, etc.
Windows 7
Node version 0.12.5 (x64)
Npm version 2.11.2
I had this problem before with my Mac
to fix this, i just simply ran
npm update -g phonegap
and behold it updated itself to 5.0.0

Resources