pimatic 安装手记

作者 donggua

2015-10-09 02.开源硬件 无评论 脚印:

1. 安装

安装node.js版本0.10(插件不支持0.11/0.12版本)。

wget http://nodejs.org/dist/v0.10.24/node-v0.10.24-linux-arm-pi.tar.gz -P /tmp
cd /usr/local
sudo tar xzvf /tmp/node-v0.10.24-linux-arm-pi.tar.gz --strip=1
检查node.js的版本:
/usr/bin/env node --version
下面开始pimatic的安装。
需要确保已安装gcc或其他合适的编译器,Debian系统上运行:
sudo apt-get install build-essential
node.js和npm都安装后,运行以下安装指令安装pimatic framework:
cd /home/pi
mkdir pimatic-app
npm install pimatic --prefix pimatic-app --production
拷贝缺省的配置文件:
cd pimatic-app
cp ./node_modules/pimatic/config_default.json ./config.json
如果pimatic-app目录内有以下文件,我们的安装可以结束了:
config.json 配置文件
node_modules framework和plugins目录
node_modules/pimatic framework文件

 

2. 运行
先在配置文件中设定admin的密码,然后通过如下指令启动pimatic服务:
sudo node_modules/pimatic/pimatic.js
安装sqlite3出了问题,可参考下面的报错信息;把安装的Raspbian由Wheezy换成Jessie后解决。
14:17:19.235 2015-10-03 Saturday
14:17:29.261 [pimatic] Starting pimatic version 0.8.85
14:17:30.007 [pimatic] Installing database package sqlite3, this can take some minutes
14:17:33.951 [pimatic, npm] http GET https://registry.npmjs.org/sqlite3
14:17:50.438 [pimatic, npm] http GET https://registry.npmjs.org/nan
14:17:52.669 [pimatic, npm]  sqlite3@3.1.0 install /home/pi/pimatic-app/node_modules/sqlite3
14:17:52.676 [pimatic, npm]  node-pre-gyp install --fallback-to-build
14:17:54.103 [pimatic, npm] node-pre-gyp http GET https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.0/node-v11-linux-arm.tar.gz
14:17:58.449 [pimatic, npm] node-pre-gyp http 403 https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.0/node-v11-linux-arm.tar.gz
14:17:58.458 [pimatic, npm] node-pre-gyp http 403 status code downloading tarball https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.0/node-v11-linux-arm.tar.gz (falling back to source compile with node-gyp) 
14:18:02.379 [pimatic, npm] gyp http GET http://nodejs.org/dist/v0.10.24/node-v0.10.24.tar.gz
14:18:03.594 [pimatic, npm] gyp http 200 http://nodejs.org/dist/v0.10.24/node-v0.10.24.tar.gz
14:19:05.797 [pimatic, npm] gyp WARN install got an error, rolling back install
14:19:05.846 [pimatic, npm] gyp ERR! configure error 
14:19:05.851 [pimatic, npm] gyp ERR! stack Error: read ECONNRESET
14:19:05.858 [pimatic, npm] gyp ERR! stack     at errnoException (net.js:901:11)
14:19:05.862 [pimatic, npm] gyp ERR! stack     at TCP.onread (net.js:556:19)
14:19:05.867 [pimatic, npm] gyp ERR! System Linux 3.18.11-v7+
...
14:19:06.904 [pimatic, npm] ERR! Failed at the sqlite3@3.1.0 install script.
14:19:06.908 [pimatic, npm] ERR! This is most likely a problem with the sqlite3 package,
14:19:06.912 [pimatic, npm] ERR! not with npm itself.
14:19:06.916 [pimatic, npm] ERR! Tell the author that this fails on your system:
14:19:06.919 [pimatic, npm] ERR!     node-pre-gyp install --fallback-to-build
14:19:06.924 [pimatic, npm] ERR! You can get their info via:
14:19:06.954 [pimatic, npm] ERR!     npm owner ls sqlite3
14:19:06.957 [pimatic, npm] ERR! There is likely additional logging output above.
14:19:06.961 [pimatic, npm] ERR! System Linux 3.18.11-v7+
14:19:06.965 [pimatic, npm] ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "sqlite3"
14:19:06.969 [pimatic, npm] ERR! cwd /home/pi/pimatic-app
14:19:06.973 [pimatic, npm] ERR! node -v v0.10.24
14:19:06.976 [pimatic, npm] ERR! npm -v 1.3.21
14:19:06.980 [pimatic, npm] ERR! code ELIFECYCLE
14:19:07.210 [pimatic, npm] ERR! 
14:19:07.214 [pimatic, npm] ERR! Additional logging details can be found in:
14:19:07.218 [pimatic, npm] ERR!     /home/pi/pimatic-app/npm-debug.log
14:19:07.223 [pimatic, npm] ERR! not ok code 0
14:19:07.290 [pimatic] Startup error: Error: Error running "npm install sqlite3"
14:19:07.290 [pimatic]    at ChildProcess.anonymous (/home/pi/pimatic-app/node_modules/pimatic/lib/plugins.coffee:272:24)
14:19:07.290 [pimatic]    at ChildProcess.EventEmitter.emit (events.js:98:17)
14:19:07.290 [pimatic]    at maybeClose (child_process.js:735:16)
14:19:07.290 [pimatic]    at Socket.anonymous (child_process.js:948:11)
14:19:07.290 [pimatic]    at Socket.EventEmitter.emit (events.js:95:17)
14:19:07.290 [pimatic]    at Pipe.close (net.js:466:12)
14:19:07.304 [pimatic] exiting...

发表评论

电子邮件地址不会被公开。 必填项已用*标注