I am using Ionic framework to build hybrid apps. According to the official website, i need to get the version 4.2.4 of Node.js, which includes npm package manager. One of the dependencies needed by Ionic is cordova so that i run the following command to get it
C:\Users\ferrero>npm install -g cordova
After then, the console logs
npm info it worked if it ends with ok
npm verb cli [ 'C:\\Program Files\\nodejs\\node.exe',
npm verb cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
npm verb cli 'prefix',
npm verb cli '-g' ]
npm info using npm@2.14.12
npm info using node@v4.2.4
npm verb exit [ 0, true ]
npm info ok
npm info it worked if it ends with ok
npm verb cli [ 'C:\\Program Files\\nodejs\\node.exe',
npm verb cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm- cli.js',
npm verb cli 'install',
npm verb cli 'cordova' ]
npm info using npm@2.14.12
npm info using node@v4.2.4
npm verb config Skipping project config: C:\Users\ferrero/.npmrc.
(matches userconfig)
npm verb install initial load of C:\Users\ferrero\package.json
npm verb readDependencies loading dependencies from C:\Users\ferrero\package.json
npm verb cache add spec cordova
npm verb addNamed "latest" is being treated as a dist-tag for cordova
npm info addNameTag [ 'cordova', 'latest' ]
npm verb addNameTag registry:https://registry.npmjs.org/cordova not in flight; fetching
npm verb request uri https://registry.npmjs.org/cordova
npm verb request no auth needed
npm info attempt registry request try #1 at 16:47:06
npm verb request id 62f85abc5c5b7cd5
npm verb etag "6KQ69KRX02Y8MUJFT56H9DE6N"
npm http request GET https://registry.npmjs.org/cordova
npm info retry will retry, error on last attempt: Error: self signed certificate in certificate chain
As you can see from log, npm run version 2.14.12 and it complains that the cause is a self signed certificate - likely issued by https://registry.npmjs.org/cordova. So, to overcome this issue, I run
npm config set registry=http://registry.npmjs.org
And, after that (just the relevant part)
C:\Users\ferrero>npm install -g cordova
npm verb cache add spec cordova
npm verb addNamed "latest" is being treated as a dist-tag for cordova
npm info addNameTag [ 'cordova', 'latest' ]
npm verb addNameTag registry:http://registry.npmjs.org/cordova not in flight; fetching
npm verb request uri http://registry.npmjs.org/cordova
npm verb request no auth needed
npm info attempt registry request try #1 at 16:59:34
npm verb request id 359f93cb3aa8b76e
npm verb etag "6KQ69KRX02Y8MUJFT56H9DE6N"
npm http request GET http://registry.npmjs.org/cordova
npm http 304 http://registry.npmjs.org/cordova
npm verb headers {
date: 'Tue, 26 Jan 2016 18:59:34 GMT',
npm verb headers via: '1.1 varnish',
npm verb headers 'cache-control': 'max-age=300',
npm verb headers etag: '"6KQ69KRX02Y8MUJFT56H9DE6N"',
npm verb headers age: '263',
npm verb headers connection: 'keep-alive',
npm verb headers 'x-served-by': 'cache-atl6230-ATL',
npm verb headers 'x-cache': 'HIT',
npm verb headers 'x-cache-hits': '1',
npm verb headers 'x-timer': 'S1453834774.362657,VS0,VE1',
npm verb headers vary: 'Accept'
}
npm verb etag http://registry.npmjs.org/cordova from cache
npm verb get saving cordova to C:\Users\ferrero\AppData\Roaming\npm-cache\registry.npmjs.org\cordova\.cache.json
npm verb addNamed "5.4.1" is a plain semver version for cordova
npm verb addRemoteTarball http://registry.npmjs.org/cordova/-/cordova-5.4.1.tgz
not in flight; adding
npm verb addRemoteTarball [ 'http://registry.npmjs.org/cordova/-/cordova-5.4.1.tgz',
npm verb addRemoteTarball 'bc56bc1d3c5387a7926408212dfbce59002f9d76' ]
This time, it does not complain anything else. Instead, the loading indicator - a pipe character - keep running and running. So, what should i do in order to download such dependency ?
Even i faced same issue while doing any
npm install -g XXX
command, it was resolved bynpm config set strict-ssl false
We seem to be looking at two distinct issues here.
The certificate error is likely due to an outbound SSL proxy. Someone, most likely your employer, is opening all SSL traffic on the way out. To fix it, you'll need to tell NPM that this certificate is okay by importing the CA certificate of the proxy in use.
You may also need to set the proxy address for npm as well:
The incompatibility with node 5.0 seems to have been fixed according to my research. The documentation just seems to be out of date.
The bug in Cordova which may have been the issue was a missing method in the Q promises library, which Cordova depends upon.
In November 2015 a user was able to use Ionic successfully with node 5.1.0.
Problem here it that you are using self-signed certificate according to error
self signed certificate in certificate chain
.If you want to fix the error here some info for you:
But if there is no way to deal with problem just set http registry(carry about
config
word)Ok, I think the note about node 4 vs node 5 is from the old days of cordova 5.0 when there was a problem when installing cordova with node 5.
Since then they released cordova 5.4 and cordova 6 where there is no more issue with node 5.
I usually don't use ionic, but to be sure, with my fresh install of node v5.4.1, where I already was running cordova 5.4 (installed also with node 5.4.1), I:
npm install -g cordova
npm install -g ionic
ionic start myApp tabs
cd myApp cordova platform add android ionic run android
And everything worked perfectly.
So I assume that you can safely try to install the latest version of node to build apps with ionic. And maybe node 5.4.1 will solve the issue you face with node 4.2.4?
A similar thing happened to me before and what worked for me back then was.
First, uninstall node and npm. Second, delete npm and npm-cache folders on C:\Users\yourname\AppData\Roaming. And lastly, redownload and reinstall a fresh copy of node.js.
I'm not sure if this is gonna work on your case but hope this helps!!