御世話になります。
windows10 で node.jsという言語からsoracomというサービスのapiを動かしたいです。
【背景】
soracom は、ドコモの通信帯を提供し、こちらのsimカードを利用することで、スマホをネットに繋げることができます。
この機能を遠隔的に操作するためには、soracomが提供しているapiを利用する必要があります。
このapiを外部から利用する方法を知りたく、サポートセンターに問い合わせたところ、awsのlambdaからsoracomのapiを利用する方法がありますというアドバイスを頂きました。
しかし、その方法に関しては、サポートセンターでも対応できず、有志の方が lambda で起動できる node.jsのプログラムを開発したので、そのサイトで勉強してくださいという連絡を受けました。
soracom api を node.js で動かす方法
さっそくwindows10 の状況で、参考記事を見て実践してみたのですが、うまく起動できない状態です。
windows10 の端末で実行できれば、そのディレクトリをzipでまとめて、lambdaにアップロードすることで、外部呼び出す機能が完成すると考えています。
【node.jsで起動するために試したこと】
1:
node.jsのwindows10 64bit版をインストールしました。
2:
参考記事にある、soracom パッケージをインストールしました。
npm install soracom
3:
参考記事のファイルをすべてダウンロードし、node.js で開く直下のディクレトリーに保存しました。
node.jsのコマンドプロントは、
C:\User\ユーザー名
で開きましたので、その下にmyfunというフォルダを作りました
4
参考記事の通りに、npm test を打ちました。
【その他】
エラーが発生した際に、eslintがないというメッセージがあり、nmp eslint をインストールしています。
【フォルダの中身】
-myfun-
-lib
-node_modules
-test
-.eslintrc.json
-.gitignoe
-package.json
-README.md
【エラーメッセージ】
shell
1C:\Users\ユーザー名\myfunc>npm test 2 3> soracom@0.0.3 pretest C:\Users\ユーザー名\myfunc 4> npm run lint 5 6 7> soracom@0.0.3 lint C:\Users\ユーザー名\myfunc 8> eslint . 9 10C:\Users\ユーザー名\myfunc\test\e2e.js 11 8:1 error "describe" is not defined no-undef 12 27:3 error "describe" is not defined no-undef 13 28:5 error "it" is not defined no-undef 14 34:3 error "describe" is not defined no-undef 15 35:5 error "it" is not defined no-undef 16 45:5 error "it" is not defined no-undef 17 50:5 error "it" is not defined no-undef 18 58:3 error "describe" is not defined no-undef 19 62:5 error "before" is not defined no-undef 20 82:5 error "it" is not defined no-undef 21 86:5 error "it" is not defined no-undef 22 90:5 error "it" is not defined no-undef 23 94:5 error "it" is not defined no-undef 24 98:5 error "it" is not defined no-undef 25 102:5 error "it" is not defined no-undef 26 110:5 error "it" is not defined no-undef 27 120:5 error "it" is not defined no-undef 28 129:3 error "describe" is not defined no-undef 29 133:5 error "before" is not defined no-undef 30 153:5 error "it" is not defined no-undef 31 164:3 error "describe" is not defined no-undef 32 181:5 error "it" is not defined no-undef 33 34C:\Users\ユーザー名\myfunc\test\helper.js 35 6:1 error "describe" is not defined no-undef 36 7:3 error "describe" is not defined no-undef 37 8:5 error "it" is not defined no-undef 38 15:5 error "it" is not defined no-undef 39 23:5 error "it" is not defined no-undef 40 41C:\Users\ユーザー名\myfunc\test\soracom.js 42 6:1 error "describe" is not defined no-undef 43 7:3 error "describe" is not defined no-undef 44 8:5 error "it" is not defined no-undef 45 17:5 error "it" is not defined no-undef 46 47✖ 31 problems (31 errors, 0 warnings) 48 49 50npm ERR! Windows_NT 10.0.14393 51npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "lint" 52npm ERR! node v6.9.2 53npm ERR! npm v3.10.9 54npm ERR! code ELIFECYCLE 55npm ERR! soracom@0.0.3 lint: `eslint .` 56npm ERR! Exit status 1 57npm ERR! 58npm ERR! Failed at the soracom@0.0.3 lint script 'eslint .'. 59npm ERR! Make sure you have the latest version of node.js and npm installed. 60npm ERR! If you do, this is most likely a problem with the soracom package, 61npm ERR! not with npm itself. 62npm ERR! Tell the author that this fails on your system: 63npm ERR! eslint . 64npm ERR! You can get information on how to open an issue for this project with: 65npm ERR! npm bugs soracom 66npm ERR! Or if that isn't available, you can get their info via: 67npm ERR! npm owner ls soracom 68npm ERR! There is likely additional logging output above. 69 70npm ERR! Please include the following file with any support request: 71npm ERR! C:\Users\ユーザー名\myfunc\npm-debug.log 72npm ERR! Test failed. See above for more details. 73
開発環境の情報で足りないことがありましたら、コメントして頂けると助かります。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/12/09 04:42
2016/12/09 05:05
2016/12/09 05:20