在 AWS EC2 上设置 Loopback 生产主机时遇到问题

Trouble setting up a Loopback production host on AWS EC2

我在 AWS EC2 上设置 StrongLoop LoopBack 生产主机时遇到问题。我正在关注 these directions

这是我试过的。我创建了一个 Ubuntu Server 14.04 LTS 的 EC2 服务器。那我:

$ ssh -i ~/mykey.pem ubuntu@[ec2-ip-address]
$ sudo apt-get update
$ sudo apt-get install build-essential
$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.25.4/install.sh | bash
$ nvm install v0.12.4
$ nvm alias default 0.12.4
$ npm install -g strong-pm

$ sudo sl-pm-install
sudo: sl-pm-install: command not found

$ sl-pm-install
Error adding user strong-pm:
useradd: Permission denied.
useradd: cannot lock /etc/passwd; try again later.
Error installing service 'undefined': Command failed: /usr/sbin/useradd --home /var/lib/strong-pm --shell /bin/false --skel /dev/null --create-home --user-group --system strong-pm
useradd: Permission denied.
useradd: cannot lock /etc/passwd; try again later.

如您所见,我无法将独立的 StrongLoop Process Manager 模块安装为 "ubuntu" 或使用 "sudo." 这让我想知道我是否应该以 root 身份安装所有内容,但我 运行 也遇到了这种方法的麻烦:

$ sudo su
# curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.25.4/install.sh | bash
# nvm install v0.12.4
# nvm alias default 0.12.4

当尝试以 root 身份安装独立的 StrongLoop Process Manager 模块时,出现以下错误:

# npm install -g strong-pm
> heapdump@0.3.5 install /root/.nvm/versions/node/v0.12.4/lib/node_modules/strong-pm/node_modules/strong-runner/node_modules/strong-supervisor/node_modules/heapdump
> node-gyp rebuild

sh: 1: node-gyp: Permission denied
npm WARN optional dep failed, continuing heapdump@0.3.5

> strong-fork-syslog@1.2.3 install /root/.nvm/versions/node/v0.12.4/lib/node_modules/strong-pm/node_modules/strong-runner/node_modules/strong-supervisor/node_modules/strong-fork-syslog
> node-gyp rebuild

sh: 1: node-gyp: Permission denied
npm WARN optional dep failed, continuing strong-fork-syslog@1.2.3

> strong-agent@1.5.1 install /root/.nvm/versions/node/v0.12.4/lib/node_modules/strong-pm/node_modules/strong-runner/node_modules/strong-supervisor/node_modules/strong-agent
> node-gyp rebuild || exit 0

sh: 1: node-gyp: Permission denied
/
> sqlite3@3.0.8 install /root/.nvm/versions/node/v0.12.4/lib/node_modules/strong-pm/node_modules/strong-mesh-models/node_modules/minkelite/node_modules/sqlite3
> node-pre-gyp install --fallback-to-build

sh: 1: node-pre-gyp: Permission denied
npm ERR! Linux 3.13.0-48-generic
npm ERR! argv "/root/.nvm/versions/node/v0.12.4/bin/node" "/root/.nvm/versions/node/v0.12.4/bin/npm" "install" "-g" "strong-pm"
npm ERR! node v0.12.4
npm ERR! npm  v2.10.1
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn

npm ERR! sqlite3@3.0.8 install: `node-pre-gyp install --fallback-to-build`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the sqlite3@3.0.8 install script 'node-pre-gyp install --fallback-to-build'.
npm ERR! This is most likely a problem with the sqlite3 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-pre-gyp install --fallback-to-build
npm ERR! You can get their info via:
npm ERR!     npm owner ls sqlite3
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/ubuntu/npm-debug.log

在 AWS EC2 上设置 StrongLoop LoopBack 生产主机的正确方法是什么?怎么做到的?

您可以使用 this blog post 中记录的以下命令从 PPA 安装 NodeJS:

$ curl -sL https://deb.nodesource.com/setup_0.12 | sudo bash -
$ sudo apt-get install -y nodejs

评论中提出的其他想法也有潜力。然而,这是我能够轻松开始工作的那个。