ubuntu 在Linux上安装Cordova

sauutmhj  于 2023-01-16  发布在  Linux
关注(0)|答案(4)|浏览(190)

如何在Ubuntu/xUbuntu上安装Cordova?
我尝试按照链接和其他源代码的指示执行npm install cordova,但没有成功。
我收到以下长错误消息:

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
cqoc49vn

cqoc49vn1#

您需要设置NPM注册表

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

rryofs0p2#

按照以下命令在ubuntu上安装cordova:
1.$sudo apt-get安装npm
2.$sudo npm安装节点
3.$sudo npm安装-g cordova
4.$ cordova
如果显示未找到命令,则使用备用命令:

  1. $sudo apt-get删除节点
    2.$sudo apt-获取安装python-软件-属性python g ++ make
    3.$sudo添加应用程序存储库ppa:chris-lea/节点. js
    4.$sudo apt-获取更新
    5.$sudo apt-get安装节点js
    6.$sudo npm安装-g cordova
    7.$ln-s/用户/bin/节点js/用户/bin/节点
flvtvl50

flvtvl503#

我想你正在寻找PhoneGap,一个基于Cordova的工具。要安装PhoneGap,你需要安装节点,然后sudo npm install -g phonegap
如果您只是需要Cordova,那么您可以在这里下载zip文件。

wz8daaqr

wz8daaqr4#

查看文档:

sudo npm install -g cordova

相关问题