Cordova install on Linux

那年仲夏 提交于 2019-12-04 21:13:55

问题


Does anyone know how to install Cordova on Ubuntu/xUbuntu?

My attempts at executing npm install cordova as directed from the link and other sources don't work.

I get the following long error message:

root@li141-82:/var/www/mysite# npm install cordova
npm http GET https://registry.npmjs.org/cordova

npm ERR! Error: failed to fetch from registry: cordova
npm ERR!     at /usr/share/npm/lib/utils/npm-registry-client/get.js:139:12
npm ERR!     at cb (/usr/share/npm/lib/utils/npm-registry-client/request.js:31:9)
npm ERR!     at Request._callback (/usr/share/npm/lib/utils/npm-registry-client/request.js:136:18)
npm ERR!     at Request.callback (/usr/lib/nodejs/request/main.js:119:22)
npm ERR!     at Request.<anonymous> (/usr/lib/nodejs/request/main.js:212:58)
npm ERR!     at Request.emit (events.js:88:20)
npm ERR!     at ClientRequest.<anonymous> (/usr/lib/nodejs/request/main.js:412:12)
npm ERR!     at ClientRequest.g (events.js:156:14)
npm ERR!     at ClientRequest.emit (events.js:67:17)
npm ERR!     at HTTPParser.parserOnIncomingClient [as onIncoming] (http.js:1256:7)
npm ERR! You may report this log at:
npm ERR!     <http://bugs.debian.org/npm>
npm ERR! or use
npm ERR!     reportbug --attach /var/www/mysite/npm-debug.log npm
npm ERR! 
npm ERR! System Linux 3.11.6-x86_64-linode35
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "cordova"
npm ERR! cwd /var/www/mysite
npm ERR! node -v v0.6.19
npm ERR! npm -v 1.1.4
npm ERR! message failed to fetch from registry: cordova
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /var/www/mysite/npm-debug.log
npm not ok

回答1:


I think you're looking for PhoneGap, a tool which is based on Cordova. To install PhoneGap you need to install node, then sudo npm install -g phonegap.

If you just need Cordova then you can download the zip file here.




回答2:


You need to set the NPM registry

npm config set registry http://registry.npmjs.org/



回答3:


look at the documentation :

sudo npm install -g cordova



回答4:


follow following commands for installing cordova on ubuntu :
1. $ sudo apt-get install npm
2. $ sudo npm install node
3. $ sudo npm install -g cordova
4. $ cordova

if it showing no command found then use alternate :
1.$ sudo apt-get remove node
2. $ sudo apt-get install python-software-properties python g++ make
3. $ sudo add-apt-repository ppa:chris-lea/node.js
4. $ sudo apt-get update
5. $ sudo apt-get install nodejs
6. $ sudo npm install -g cordova
7. $ ln -s /usr/bin/nodejs /usr/bin/node



来源:https://stackoverflow.com/questions/21207948/cordova-install-on-linux

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!