Chinese Documentation : 安装 StrongLoop

任务

请先在安装Node.js 然后用 npm 安装StrongLoop. 通过安装StrongLoop你的机器会安装以下内容

安装

根据你的操作系统选择相应的安装方式

Windows

安装 Node.js

Icon

If you want features such as CPU profiling, heap memory profiling, performance metrics, object tracking, loggging to syslog, among others, follow the full instructions in Installing on Windows.

Otherwise, you can just download and run the native installer from nodejs.orgNote that you may see error messages during installation and when running applications with slc.

重新安装 npm

Windows版Node自带的npm在Windows上有不少问题,我们建议重新安装npm2:

$ npm install -g npm

使用 StrongLoop Controller (slc)的前提


安装 StrongLoop

步骤:

  1. 打开Windows的命令行。 注意Node 不支持Cygwin. 我们必须使用Windows Command Prompt (shell).
  2. 安装 StrongLoop:

    C:\> npm install -g strongloop
    Icon

    如果你没有安装编译工具你会在安装过程中看到 node-gyp 和 Python 产生很多错误。这些错误会导致你无法使用一些监控管理的功能,请参考install compiler tools 安装编译工具。

安装出现问题可参考 Installation troubleshooting.

Mac OSX 

设置目录及权限

安装Node和StrongLoop, 需要取得以下目录的写权限:

  • /usr/local/bin 
  • /usr/local/lib/node_modules 

虽然你可以用sudo执行node,但是为了方便起见,最好将那些目录按以下权限设置。

$ sudo chown -R $USER /usr/local/bin
$ sudo chown -R $USER /usr/local/lib/node_modules
Icon

在生产环境中千万不要修改权限,以上方法仅为了方便开发环境

These commands make your user account the owner of the /usr/local/bin  and /usr/local/lib/node_modules directories. Then you won't have to use sudo to install Node or install packages globally with npm.  For more information, see How to Node.

安装 Node.js

Icon

如果已经安装,跳过此步骤

安装 Node.js: 下载 native installer from nodejs.org.

安装 StrongLoop

步骤

  1. 打开Terminal.
  2. 输入命令:

    $ npm install -g strongloop

    如果你未设置全面提到的权限,用以下命令安装strongloop, 否则省略sudo

    $ sudo npm install -g strongloop
    Icon

    如果你没有安装编译工具你会在安装过程中看到 node-gyp 和 Python 产生很多错误。这些错误会导致你无法使用一些监控管理的功能,请参考install compiler tools 安装编译工具。

安装出现问题可参考 Installation troubleshooting.

Linux

设置目录及权限

安装Node和StrongLoop, 需要取得以下目录的写权限:

  • /usr/local/bin 
  • /usr/local/lib/node_modules 

虽然你可以用sudo执行node,但是为了方便起见,最好将那些目录按以下权限设置。

$ sudo chown -R $USER /usr/local/bin
$ sudo chown -R $USER /usr/local/lib/node_modules
Icon

在生产环境中千万不要修改权限,以上方法仅为了方便开发环境

These commands make your user account the owner of the /usr/local/bin  and /usr/local/lib/node_modules directories. Then you won't have to use sudo to install Node or install packages globally with npm.  For more information, see How to Node.

安装 Node.js

Icon

如果已经安装,跳过此步骤

安装 Node.js: 参考 Installing Node.js via package manager.

安装 StrongLoop  

Follow these steps:

  1. 打开Terminal.
  2. 输入命令:

    $ npm install -g strongloop

    如果你未设置全面提到的权限,用以下命令安装strongloop, 否则省略sudo

    $ sudo npm install -g strongloop
    Icon

    如果你没有安装编译工具你会在安装过程中看到 node-gyp 和 Python 产生很多错误。这些错误会导致你无法使用一些监控管理的功能,请参考install compiler tools 安装编译工具。

安装出现问题可参考 Installation troubleshooting.

确认安装

使用slc命令确认你是否安装成功

$ slc --help

你会看到标准的map page

SLC()                                                           SLC()

NAME
       slc - StrongLoop Controller
       Command-line tool for development and control of a Node application.
 ...

如果你看到了以上输出,恭喜你,安装成功了。