BeagleBone Black의 Ubuntu.04.1 Eclipse Orion 설치

BeagleBone Black의 펌웨어Angstrom를 사용할 때는 기본적으로 웹 브라우저에서 실행되는 IDECloud9가 설치되어 있습니다.SD 카드 Ubuntu 14.04.1 노드.js와npm가 설치되어 있습니다.클라우드 9 대신 저번를 사용해 보세요.오리온은 클라우드 파운드리와 협력을 강화해 IBM DevOps 서비스에서도 채택됐다.

Eclipse Orion 설치


Node.js와 npm의 버전을 확인하십시오.
$ node -v
v0.10.25
$ npm -v
1.3.10

CERT_NOT_YET_VAID 오류 발생


npm에서 오리온을 설치할 때CERT_NOT_YET_VALID에 오류가 발생했습니다.
$ npm install orion --production
npm http GET https://registry.npmjs.org/orion
npm http GET https://registry.npmjs.org/orion
npm http GET https://registry.npmjs.org/orion
npm ERR! Error: CERT_NOT_YET_VALID
npm ERR!     at SecurePair.<anonymous> (tls.js:1370:32)
npm ERR!     at SecurePair.EventEmitter.emit (events.js:92:17)
...

ntpdate로 시간 조정


CERT_NOT_YET_VAID 오류는 시간이 겹치지 않을 때 발생합니다.BeagleBone Black에 배터리가 탑재되어 있지 않기 때문에 전원을 연결하지 않으면 시스템 시계가 이동합니다.tapdate를 진행하여 시스템 시계의 시간을 조정합니다.
$ sudo ntpdate -b -s -u pool.ntp.org

설치 및 시작


다시 설치합니다.
$ npm install orion --production
npm start Orion 서버를 시작합니다.
$ npm start orion

> [email protected] start /home/ubuntu/node_modules/orion
> node server.js

Could not find npm in the following locations:
/usr/bin/../lib/node_modules/npm/bin/npm-cli.js
/usr/bin/./node_modules/npm/bin/npm-cli.js
Please add or modify the npm_path in the orion.conf file and restart the server.

Using workspace: /home/ubuntu/node_modules/orion/.workspace
Listening on port 8081...
브라우저에서 Orion의 시작을 확인합니다.
Eclise Orion

Orion 데모


Orion 프로세스를 일시 중지합니다.pm2에 프로그램을 등록하는 스크립트를 실행합니다.
~/pm2_orion.sh
#!/bin/bash
read -d '' my_json <<_EOF_
{
  "name"       : "orion",
  "script"     : "/home/ubuntu/node_modules/orion/server.js"
}
_EOF_

echo $my_json | pm2 start -
pm2가 시작되면 Cloud9이 시작됩니다.
$ chmod u+x pm2_orion.sh
$ ./pm2_orion.sh
[PM2] Process launched
┌──────────┬────┬──────┬──────┬────────┬───────────┬────────┬────────────┬──────────┐
│ App name │ id │ mode │ PID  │ status │ restarted │ uptime │     memory │ watching │
├──────────┼────┼──────┼──────┼────────┼───────────┼────────┼────────────┼──────────┤
│ orion    │ 1  │ fork │ 1898 │ online │         0 │ 0s     │ 4.117 MB   │ disabled │
└──────────┴────┴──────┴──────┴────────┴───────────┴────────┴────────────┴──────────┘
 Use `pm2 info <id|name>` to get more details about an app
OS를 다시 시작하면pm2에 등록된 프로세스를 시작하기 위해 init 스크립트를 만듭니다.
$ sudo pm2 startup ubuntu -u ubuntu
$ sudo /etc/init.d/pm2-init.sh restart
init 스크립트가 생성된 경우 OS가 재부팅된 후 프로세스가 저장됩니다.
$ sudo pm2 save
[PM2] Dumping processes

hello world


화면 편집


간단한 노드.js 스크립트를 만들고 실행합니다.
Editor에서 "hello"폴더를 만듭니다.
  • File > New > Folder > hello
  • Hello 폴더를 선택하여 "세계.js"파일을 만듭니다.
  • New > File > world.js
  • console.log 코드를 쓰고 경고를 표시했습니다.

    world.js
    console.log("hello world");
    
    오리온은 JavaScript의 유효성 검사 및 구문 검사에를 사용합니다.화면 마법사에 eslint-env 지시를 추가합니다.
    world.js
    /*eslint-env node */
    console.log("hello world");
    

    스크린


    왼쪽 메뉴에서 셸을 선택합니다.화면 아래의 콘솔에서 만든 스크립트를 실행합니다.
    » node start hello.js
    
    ESLint

    좋은 웹페이지 즐겨찾기