回答編集履歴
2
追記: コンソール出力
test
CHANGED
@@ -32,16 +32,166 @@
|
|
32
32
|
|
33
33
|
|
34
34
|
|
35
|
+
- node.js は、nvmを使用して、lts版をインストールしました。
|
35
36
|
|
36
37
|
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
### 参考: 実行した際のコンソール出力
|
42
|
+
|
37
|
-
- node
|
43
|
+
- 実行例: nodeのインストール
|
44
|
+
|
45
|
+
|
38
46
|
|
39
47
|
```
|
40
48
|
|
41
|
-
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.7/install.sh | bash
|
49
|
+
pi@raspberrypi:~ $ curl -s -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.7/install.sh | bash
|
42
50
|
|
43
|
-
s
|
51
|
+
=> Downloading nvm as script to '/home/pi/.nvm'
|
44
52
|
|
53
|
+
|
54
|
+
|
55
|
+
=> Appending nvm source string to /home/pi/.bashrc
|
56
|
+
|
57
|
+
=> Appending bash_completion source string to /home/pi/.bashrc
|
58
|
+
|
59
|
+
=> Close and reopen your terminal to start using nvm or run the following to use it now:
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
export NVM_DIR="$HOME/.nvm"
|
64
|
+
|
65
|
+
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
|
66
|
+
|
67
|
+
[ -s "$NVM_DIR/bash_completion" ] && . "$NVM_DIR/bash_completion" # This loads nvm bash_completion
|
68
|
+
|
69
|
+
pi@raspberrypi:~ $ source ~/.bashrc
|
70
|
+
|
45
|
-
nvm install --lts && node --version
|
71
|
+
pi@raspberrypi:~ $ nvm install --lts && node --version
|
72
|
+
|
73
|
+
Installing latest LTS version.
|
74
|
+
|
75
|
+
Downloading and installing node v8.9.3...
|
76
|
+
|
77
|
+
Downloading https://nodejs.org/dist/v8.9.3/node-v8.9.3-linux-armv7l.tar.xz...
|
78
|
+
|
79
|
+
######################################################################## 100.0%
|
80
|
+
|
81
|
+
Computing checksum with sha256sum
|
82
|
+
|
83
|
+
Checksums matched!
|
84
|
+
|
85
|
+
Creating default alias: default -> lts/* (-> v8.9.3)
|
86
|
+
|
87
|
+
v8.9.3
|
46
88
|
|
47
89
|
```
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
- 実行例: milkcocoaのnodeパッケージインストール、アプリ作成、実行
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
```
|
98
|
+
|
99
|
+
pi@raspberrypi:~ $ mkdir mytestapp
|
100
|
+
|
101
|
+
pi@raspberrypi:~ $ cd mytestapp
|
102
|
+
|
103
|
+
pi@raspberrypi:~/mytestapp $ time npm install milkcocoa
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
> bufferutil@1.2.1 install /home/pi/mytestapp/node_modules/bufferutil
|
108
|
+
|
109
|
+
> node-gyp rebuild
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
make: Entering directory '/home/pi/mytestapp/node_modules/bufferutil/build'
|
114
|
+
|
115
|
+
CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
|
116
|
+
|
117
|
+
SOLINK_MODULE(target) Release/obj.target/bufferutil.node
|
118
|
+
|
119
|
+
COPY Release/bufferutil.node
|
120
|
+
|
121
|
+
make: Leaving directory '/home/pi/mytestapp/node_modules/bufferutil/build'
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
> utf-8-validate@1.2.2 install /home/pi/mytestapp/node_modules/utf-8-validate
|
126
|
+
|
127
|
+
> node-gyp rebuild
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
make: Entering directory '/home/pi/mytestapp/node_modules/utf-8-validate/build'
|
132
|
+
|
133
|
+
CXX(target) Release/obj.target/validation/src/validation.o
|
134
|
+
|
135
|
+
SOLINK_MODULE(target) Release/obj.target/validation.node
|
136
|
+
|
137
|
+
COPY Release/validation.node
|
138
|
+
|
139
|
+
make: Leaving directory '/home/pi/mytestapp/node_modules/utf-8-validate/build'
|
140
|
+
|
141
|
+
npm WARN saveError ENOENT: no such file or directory, open '/home/pi/mytestapp/package.json'
|
142
|
+
|
143
|
+
npm notice created a lockfile as package-lock.json. You should commit this file.
|
144
|
+
|
145
|
+
npm WARN enoent ENOENT: no such file or directory, open '/home/pi/mytestapp/package.json'
|
146
|
+
|
147
|
+
npm WARN mytestapp No description
|
148
|
+
|
149
|
+
npm WARN mytestapp No repository field.
|
150
|
+
|
151
|
+
npm WARN mytestapp No README data
|
152
|
+
|
153
|
+
npm WARN mytestapp No license field.
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
+ milkcocoa@0.7.0
|
158
|
+
|
159
|
+
added 45 packages in 41.013s
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
real 0m43.085s
|
164
|
+
|
165
|
+
user 0m22.560s
|
166
|
+
|
167
|
+
sys 0m1.370s
|
168
|
+
|
169
|
+
pi@raspberrypi:~/mytestapp $ cat <<EOF > test.js
|
170
|
+
|
171
|
+
> var MilkCocoa = require('milkcocoa');
|
172
|
+
|
173
|
+
> var milkcocoa = new MilkCocoa('applejb2g3tnb.mlkcca.com');
|
174
|
+
|
175
|
+
> var ds = milkcocoa.dataStore('test');
|
176
|
+
|
177
|
+
> ds.on("push", function(data){
|
178
|
+
|
179
|
+
> console.log(data.value.message);
|
180
|
+
|
181
|
+
> });
|
182
|
+
|
183
|
+
> ds.push({message:'Hello World!'});
|
184
|
+
|
185
|
+
> EOF
|
186
|
+
|
187
|
+
pi@raspberrypi:~/mytestapp $
|
188
|
+
|
189
|
+
pi@raspberrypi:~/mytestapp $ node ./test.js
|
190
|
+
|
191
|
+
Hello World!
|
192
|
+
|
193
|
+
^C
|
194
|
+
|
195
|
+
pi@raspberrypi:~/mytestapp $
|
196
|
+
|
197
|
+
```
|
1
途中で送信してしまった
test
CHANGED
@@ -3,6 +3,10 @@
|
|
3
3
|
|
4
4
|
|
5
5
|
この部分は、書き換えましたか?
|
6
|
+
|
7
|
+
milkcocoaのサイトにて、アプリ作成後、アプリの名前をクリックすると、概要のページにでています。
|
8
|
+
|
9
|
+
|
6
10
|
|
7
11
|
```
|
8
12
|
|
@@ -11,3 +15,33 @@
|
|
11
15
|
var milkcocoa = new MilkCocoa('your-app-id.mlkcca.com');
|
12
16
|
|
13
17
|
```
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
以下の環境にて、test.js の動作を確認できました。
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
Raspberry Pi 3 Model B
|
28
|
+
|
29
|
+
Raspbian: 2017-11-29-raspbian-stretch-lite.zip
|
30
|
+
|
31
|
+
node v8.9.3 (lts)
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
- node.js は、nvmを使用して、lts版をインストールしました。
|
38
|
+
|
39
|
+
```
|
40
|
+
|
41
|
+
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.7/install.sh | bash
|
42
|
+
|
43
|
+
source ~/.bashrc
|
44
|
+
|
45
|
+
nvm install --lts && node --version
|
46
|
+
|
47
|
+
```
|