简体   繁体   English

PhoneGap安装:未找到npm命令

[英]PhoneGap Installation : npm command not found

I have a Mac OS X version 10.9.1.我有一个 Mac OS X 版本 10.9.1。 I tried installing PhoneGap via the command line我尝试通过命令行安装 PhoneGap

$ sudo npm install -g phonegap

BUT i get the following error:但我收到以下错误:

sudo: npm: command not found

You need to have the Node Package Manager installed on your system. 您需要在系统上安装Node Package Manager。

https://npmjs.org/ https://npmjs.org/

This requires you to install Node.js 这需要您安装Node.js

If your npm isn't installed in /usr/local/bin, you must create a symbolic link for it first. 如果您的npm未安装在/ usr / local / bin中,则必须首先为其创建符号链接。

$ sudo ln -s $(which npm) /usr/local/bin/npm
$ sudo npm install -g phonegap

If u already install Node package and still getting the same error, then check the bin (/usr/local/bin) folder permission. 如果您已经安装了Node软件包并且仍然遇到相同的错误,请检查bin(/ usr / local / bin)文件夹权限。

If you don't have enough permission then change folder the permission using below command. 如果您没有足够的权限,请使用以下命令更改文件夹的权限。

sudo chmod -R 777 /usr/local/bin

I have shared my whole experience while installing the phone gap is here 我已经分享了我在安装手机缝隙时的全部经验

https://sites.google.com/site/greateindiaclub/mobil-apps/ios/phonegapinstalltionwithnodejs https://sites.google.com/site/greateindiaclub/mobil-apps/ios/phonegapinstalltionwithnodejs

The phonegap is installed using the node package manager(NPM) , the package is not available on your pc , so you need to install it. phonegap使用节点软件包管理器(NPM)安装该软件包在您的pc上不可用 ,因此您需要安装它。

use this command to install, 使用此命令进行安装,

sudo apt-get install npm 须藤apt-get install npm

It will fix the issue. 它将解决此问题。 then do the installation command . 然后执行安装命令。

In one of the answers to the question suggesting chmod -R 777 - I must warn against using. 在建议chmod -R 777的问题的答案之一中,我必须警告您不要使用。


chmod -R 777 /usr/local/bin chmod -R 777 / usr / local / bin


This means that all files in bin and its subdirectories will be readable, writable and executable by the whole world. 这意味着bin及其子目录中的所有文件在全世界都是可读,可写和可执行的。



If one did so by accident, as minimum change it to 如果有人偶然这样做,请至少将其更改为

chmod -R 755 /usr/local/bin chmod -R 755 / usr / local / bin

and then think closer about how the permissions should be set after that. 然后仔细考虑之后应如何设置权限。

you are getting this error because you do not have NODE packages installed in your machine.您收到此错误是因为您的机器中没有安装 NODE 包。 Download and install it before running npm install command from below link https://nodejs.org/en/download/从下面的链接https://nodejs.org/en/download/运行 npm 安装命令之前下载并安装它

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM