npm的建议方法是什么

npm的建议方法是什么

本文介绍了在OS X上安装brew,node.js,io.js,nvm,npm的建议方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试尽可能多地使用自制软件.在OS X上安装以下内容的建议方法是什么?

I am trying to use homebrew as much as possible. What's the suggested way to install the following on OS X?

  • node.js
  • io.js
  • nvm
  • npm

并希望支持以下项目的开发:

and hopefully supports development for:

  • ionic
  • ngCordova

推荐答案

  1. 使用homebrew安装nvm:

brew update
brew install nvm
source $(brew --prefix nvm)/nvm.sh

将最后一个命令添加到.profile.bashrc.zshrc文件中,以免在每次终端启动时再次运行该命令.因此,例如,将其添加到.profile运行中:

Add the last command to the .profile, .bashrc or .zshrc file to not run it again on every terminal start. So for example to add it to the .profile run:

echo "source $(brew --prefix nvm)/nvm.sh" >> ~/.profile

如果在使用brew安装nvm时遇到问题,可以手动安装(请参见此处 )

If you have trouble with installing nvm using brew you can install it manually (see here)

使用nvm安装nodeiojs(可以安装所需的任何版本):

Using nvm install node or iojs (you can install any version you want):

nvm install 0.10
# or
nvm install iojs-1.2.0

  • npmnode(或iojs)一起提供,因此在安装node(或iojs)后将可用.您可能需要将其升级到最新版本:

  • npm is shipping with node (or iojs), so it will be available after installing node (or iojs). You may want to upgrade it to the latest version:

    $ npm install -g npm@latest
    

    .感谢@Metallica指出了正确的方法(请看下面的评论).

    . Thanks to @Metallica for pointing to the correct way (look at the comment bellow).

    使用npm安装ionic:

    npm install -g ionic
    

  • 关于ngCordova的情况:您可以使用npmbower安装它.我不知道哪种变体更适合您,这取决于您要在客户端使用的包管理器.因此,我将同时描述它们:

  • What about ngCordova: you can install it using npm or bower. I don't know what variant is more fit for you, it depends on the package manager you want to use for the client side. So I'll describe them both:

    1. 使用npm :转到项目文件夹并在其中安装ng-cordova:

    npm install --save ng-cordova
    

  • 使用bower :安装凉亭:

  • Using bower: Install bower:

     npm install -g bower
    

    然后转到您的项目文件夹并在其中安装ngCordova:

    And then go to your project folder and install ngCordova in it:

     bower install --save ngCordova
    

  • PS

    1. 某些命令可能需要超级用户特权
    2. npm install some_module的短变体是npm i some_module
    1. Some commands may require superuser privilege
    2. Short variant of npm install some_module is npm i some_module

    这篇关于在OS X上安装brew,node.js,io.js,nvm,npm的建议方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

    09-02 04:37