çµè«ããããã°é å¼µã£ã¦åããããWindowså´ããã確èªã§ããããããã¾ããBash on Ubuntu on Windowsã£ã¦ããå称ãonã°ã£ããã ãªã
Â
é¢é£ã¨ã³ããª
Node.jsã¨npmã®ã¤ã³ã¹ãã¼ã«
npmããã¾ãã¤ã³ã¹ãã¼ã«ã§ããªã
 ã¾ãã¯ã¤ã³ã¹ãã¼ã«ãapt-getã§å ¥ããã¢ã¸ã¥ã¼ã«ã¯ nodejs 㨠npmãªã®ã ãã
apt-get install nodejs
ã§ãNode.jsã¯ãã¡ãã¨ã¤ã³ã¹ãã¼ã«ã§ããããããã
apt-get install npm
ãå®è¡ãã¦ããã¡ãã¨ã¤ã³ã¹ãã¼ã«ã§ãããçµæã¯ãããªãã
root@STRIKEEAGLE:~# apt-get install npm ããã±ã¼ã¸ãªã¹ããèªã¿è¾¼ãã§ãã¾ã... å®äº0% ä¾åé¢ä¿ããªã¼ãä½æãã¦ãã¾ã ç¶æ æ å ±ãèªã¿åã£ã¦ãã¾ã... å®äº ã¤ã³ã¹ãã¼ã«ãããã¨ãã§ããªãããã±ã¼ã¸ãããã¾ããããããããããå¾ ãªãç¶æ³ãè¦æ±ãããã(ä¸å®å®çãã£ã¹ããªãã¥ã¼ã·ã§ã³ã使ç¨ãã¦ããã® ã§ããã°) å¿ è¦ãªããã±ã¼ã¸ãã¾ã ä½æããã¦ããªãã£ãã Incoming ãã移 åããã¦ããªããã¨ãèãããã¾ãã 以ä¸ã®æ å ±ããã®åé¡ã解決ããããã«å½¹ç«ã¤ããããã¾ãã: 以ä¸ã®ããã±ã¼ã¸ã«ã¯æºãããªãä¾åé¢ä¿ãããã¾ã: npm : ä¾å: nodejs ããããã¤ã³ã¹ãã¼ã«ããããã¨ãã¦ãã¾ãã ä¾å: node-abbrev (>= 1.0.4) ããããã¤ã³ã¹ãã¼ã«ããããã¨ãã¦ãã¾ãã ä¾å: node-ansi ããããã¤ã³ã¹ãã¼ã«ããããã¨ãã¦ãã¾ãã ä¾å: node-archy ããããã¤ã³ã¹ãã¼ã«ããããã¨ãã¦ãã¾ãã ä¾å: node-block-stream ããããã¤ã³ã¹ãã¼ã«ããããã¨ãã¦ãã¾ãã ä¾å: node-fstream (>= 0.1.22) ããããã¤ã³ã¹ãã¼ã«ããããã¨ãã¦ãã¾ãã ä¾å: node-fstream-ignore ããããã¤ã³ã¹ãã¼ã«ããããã¨ãã¦ãã¾ãã ä¾å: node-github-url-from-git ããããã¤ã³ã¹ãã¼ã«ããããã¨ãã¦ãã¾ãã ä¾å: node-glob (>= 3.1.21) ããããã¤ã³ã¹ãã¼ã«ããããã¨ãã¦ãã¾ãã ä¾å: node-graceful-fs (>= 2.0.0) ããããã¤ã³ã¹ãã¼ã«ããããã¨ãã¦ãã¾ãã ä¾å: node-inherits ããããã¤ã³ã¹ãã¼ã«ããããã¨ãã¦ãã¾ãã ä¾å: node-ini (>= 1.1.0) ããããã¤ã³ã¹ãã¼ã«ããããã¨ãã¦ãã¾ãã ä¾å: node-lockfile ããããã¤ã³ã¹ãã¼ã«ããããã¨ãã¦ãã¾ãã ä¾å: node-lru-cache (>= 2.3.0) ããããã¤ã³ã¹ãã¼ã«ããããã¨ãã¦ãã¾ãã ä¾å: node-minimatch (>= 0.2.11) ããããã¤ã³ã¹ãã¼ã«ããããã¨ãã¦ãã¾ãã ä¾å: node-mkdirp (>= 0.3.3) ããããã¤ã³ã¹ãã¼ã«ããããã¨ãã¦ãã¾ãã ä¾å: node-gyp (>= 0.10.9) ããããã¤ã³ã¹ãã¼ã«ããããã¨ãã¦ãã¾ãã ä¾å: node-nopt (>= 2.1.1) ããããã¤ã³ã¹ãã¼ã«ããããã¨ãã¦ãã¾ãã ä¾å: node-npmlog ããããã¤ã³ã¹ãã¼ã«ããããã¨ãã¦ãã¾ãã ä¾å: node-once ããããã¤ã³ã¹ãã¼ã«ããããã¨ãã¦ãã¾ãã ä¾å: node-osenv ããããã¤ã³ã¹ãã¼ã«ããããã¨ãã¦ãã¾ãã ä¾å: node-read ããããã¤ã³ã¹ãã¼ã«ããããã¨ãã¦ãã¾ãã ä¾å: node-read-package-json (>= 1.1.0) ããããã¤ã³ã¹ãã¼ã«ããããã¨ãã¦ãã¾ãã ä¾å: node-request (>= 2.25.0) ããããã¤ã³ã¹ãã¼ã«ããããã¨ãã¦ãã¾ãã ä¾å: node-retry ããããã¤ã³ã¹ãã¼ã«ããããã¨ãã¦ãã¾ãã ä¾å: node-rimraf (>= 2.2.2) ããããã¤ã³ã¹ãã¼ã«ããããã¨ãã¦ãã¾ãã ä¾å: node-semver (>= 2.1.0) ããããã¤ã³ã¹ãã¼ã«ããããã¨ãã¦ãã¾ãã ä¾å: node-sha ããããã¤ã³ã¹ãã¼ã«ããããã¨ãã¦ãã¾ãã ä¾å: node-slide ããããã¤ã³ã¹ãã¼ã«ããããã¨ãã¦ãã¾ãã ä¾å: node-tar (>= 0.1.18) ããããã¤ã³ã¹ãã¼ã«ããããã¨ãã¦ãã¾ãã ä¾å: node-which ããããã¤ã³ã¹ãã¼ã«ããããã¨ãã¦ãã¾ãã E: åé¡ã解決ãããã¨ãã§ãã¾ãããå£ããå¤æ´ç¦æ¢ããã±ã¼ã¸ãããã¾ãã
ã¨ããã¨ã©ã¼ã¡ãã»ã¼ã¸ã§ãããapt-get updateçãå®è¡ãã¦ã解æ¶ã§ããªããnpm -vã§ç¢ºèªãã¦ã¿ãã¨ãã®éãã
root@STRIKEEAGLE:~# npm -v /usr/lib/node_modules/npm/node_modules/npmconf/config-defs.js:320 Object.keys(os.networkInterfaces()).map(function (nic) { ^ Error: EINVAL, invalid argument at getLocalAddresses (/usr/lib/node_modules/npm/node_modules/npmconf/config-defs.js:320:18) at Object.(/usr/lib/node_modules/npm/node_modules/npmconf/config-defs.js:268:23) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:364:17) at require (module.js:380:17) at Object. (/usr/lib/node_modules/npm/node_modules/npmconf/npmconf.js:4:18) at Module._compile (module.js:456:26)
npmã¯apt-getã§ã¯ãªãcurlã§ã¤ã³ã¹ãã¼ã«
ããã§è²ã 調ã¹ã¦ãã£ãçµæããã®ã³ãã³ãã«è¡ãã¤ããã
curl -0 -L http://npmjs.org/install.sh | sudo sh
å®è¡çµæã¯æ¬¡ã®éããå°ãé·ãã®ã§ä¸ç¥ãã¦ããã
root@STRIKEEAGLE:~# curl -0 -L http://npmjs.org/install.sh | sudo sh % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 193 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0 100 6263 100 6263 0 0 1811 0 0:00:03 0:00:03 --:--:-- 9650 tar=/bin/tar version: tar (GNU tar) 1.27.1 Copyright (C) 2013 Free Software Foundation, Inc. 使ç¨è¨±è«¾ GPLv3+: GNU GPL version 3 ã¾ãã¯ãã以é <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. [åè訳] ããã¯ããªã¼ã½ããã¦ã§ã¢ã§ã. å¤æ´ã¨åé å¸ã¯èªç±ã§ã. æ³å¾ã§èªããããç¯å²ã§ãç¡ä¿è¨¼ãã§ã. ä½è : John Gilmore, Jay Fenlason. install npm@latest fetching: http://registry.npmjs.org/npm/-/npm-3.10.2.tgz (ä¸ç¥) âââ [email protected] âââ [email protected] ââ⬠[email protected] â âââ [email protected] âââ [email protected] ââ⬠[email protected] â ââ⬠[email protected] â â âââ [email protected] â ââ⬠[email protected] â âââ [email protected] â âââ [email protected] ââ⬠[email protected] â âââ [email protected] ââ⬠[email protected] â âââ [email protected] âââ [email protected] âââ [email protected] It worked
ãã®curlã§ãã¡ãã¨npmã¯å ¥ã£ãã£ã½ããnpm -vã§ç¢ºèªããã¨ã
root@STRIKEEAGLE:~# npm -v 3.10.2
ã¨ãªãããã® curl -0 -L http://npmjs.org/install.sh | sudo sh ã¯ãä¸è¨ã®ãµã¤ããåèã«ããã
Node.jsã®åä½ç¢ºèª
REPLã§åä½ç¢ºèª
ç¶ãã¦REPL(Read eval print loop:対話çå®è¡ç°å¢)ã§Node.jsã®åä½ç¢ºèªãBash on Ubuntu on Windowsã§
root@STRIKEEAGLE:~# node > var message = "ããã«ã¡ã¯"; undefined > message 'ããã«ã¡ã¯' > console.log(message + "shigeo-t"); ããã«ã¡ã¯shigeo-t undefined > (^C again to quit) > root@STRIKEEAGLE:~#
ã¨ãã¡ãã¨åããÂ
npmã³ãã³ãã®åä½ç¢ºèª
npmã³ãã³ãã®åä½ç¢ºèªã¨ãã¦gulpã³ãã³ããå ¥ãã¦ã¿ãã
root@STRIKEEAGLE:~# npm install -g gulp npm WARN deprecated [email protected]: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree. npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue npm WARN deprecated [email protected]: lodash@<3.0.0 is="" no="" longer="" maintained="" upgrade="" to="" lodash="" 4="" 0="" npm="" warn="" deprecated="" graceful-fs="" 1="" 2="" 3:="" v3="" and="" before="" will="" fail="" on="" node="" releases="">= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree. /usr/bin/gulp -> /usr/lib/node_modules/gulp/bin/gulp.js /usr/lib ââ⬠[email protected] âââ [email protected] ââ⬠[email protected] â âââ ansi[email protected] â âââ escape-string-regexp@1.0.5 â ââ⬠has-ansi@2.0.0 â â âââ ansi-regex@2.0.0 â âââ strip-ansi@3.0.1 â âââ [email protected] âââ [email protected] ââ⬠[email protected] â âââ [email protected] â âââ [email protected] â âââ [email protected] â ââ⬠[email protected] â â âââ [email protected] â â ââ⬠[email protected] â â ââ⬠[email protected] â â â âââ [email protected] â â âââ [email protected] â â ââ⬠[email protected] â â â ââ⬠[email protected] â â â â âââ [email protected] â â â âââ [email protected] â â âââ [email protected] â â ââ⬠[email protected] â â â âââ [email protected] â â â ââ⬠[email protected] â â â â âââ [email protected] â â â ââ⬠[email protected] â â â ââ⬠[email protected] â â â â âââ [email protected] â â â ââ⬠[email protected] â â â âââ [email protected] â â âââ [email protected] â â ââ⬠[email protected] â â â ââ⬠[email protected] â â â â âââ [email protected] â â â â ââ⬠[email protected] â â â â âââ [email protected] â â â ââ⬠[email protected] â â â ââ⬠load-json[email protected] â â â â âââ [email protected] â â â â ââ⬠parse-json@2.2.0 â â â â â ââ⬠[email protected] â â â â â âââ [email protected] â â â â âââ [email protected] â â â â âââ [email protected] â â â âââ [email protected] â â ââ⬠[email protected] â â â ââ⬠[email protected] â â â â ââ⬠[email protected] â â â â ââ⬠[email protected] â â â â âââ [email protected] â â â âââ [email protected] â â âââ [email protected] â ââ⬠[email protected] â â âââ [email protected] â ââ⬠[email protected] â â âââ [email protected] â ââ⬠[email protected] â â âââ [email protected] â âââ [email protected] â âââ [email protected] â âââ [email protected] â ââ⬠[email protected] â â âââ [email protected] â â âââ [email protected] â â âââ [email protected] â â âââ [email protected] â â ââ⬠[email protected] â â â âââ [email protected] â â ââ⬠[email protected] â â â âââ [email protected] â â â âââ [email protected] â â â âââ [email protected] â â âââ [email protected] â â âââ [email protected] â ââ⬠[email protected] â â ââ⬠[email protected] â â âââ [email protected] â âââ [email protected] â âââ [email protected] â ââ⬠[email protected] â â ââ⬠[email protected] â â â âââ [email protected] â â â âââ [email protected] â â â âââ [email protected] â â â âââ [email protected] â â â âââ [email protected] â â â âââ [email protected] â â âââ [email protected] â ââ⬠[email protected] â âââ [email protected] â âââ [email protected] âââ [email protected] ââ⬠[email protected] â âââ [email protected] â ââ⬠[email protected] â â ââ⬠[email protected] â â âââ [email protected] â â âââ [email protected] â â âââ [email protected] â âââ [email protected] â âââ [email protected] â âââ [email protected] âââ [email protected] ââ⬠[email protected] â ââ⬠[email protected] â â ââ⬠[email protected] â â âââ [email protected] â âââ [email protected] â âââ [email protected] âââ [email protected] âââ [email protected] ââ⬠[email protected] â âââ [email protected] ââ⬠[email protected] â âââ [email protected] ââ⬠[email protected] âââ [email protected] ââ⬠[email protected] â âââ [email protected] â ââ⬠[email protected] â â âââ [email protected] â ââ⬠[email protected] â â ââ⬠[email protected] â â âââ [email protected] â â âââ [email protected] â âââ [email protected] â ââ⬠[email protected] â â âââ [email protected] â âââ [email protected] ââ⬠[email protected] â ââ⬠[email protected] â ââ⬠[email protected] â ââ⬠[email protected] â â âââ [email protected] â â âââ [email protected] â âââ [email protected] â ââ⬠[email protected] â âââ [email protected] â âââ [email protected] âââ [email protected] ââ⬠[email protected] â âââ [email protected] ââ⬠[email protected] â âââ [email protected] â âââ [email protected] ââ⬠[email protected] â ââ⬠[email protected] â âââ [email protected] ââ⬠[email protected] âââ [email protected] root@STRIKEEAGLE:~# gulp -v [03:01:47] CLI version 3.9.1
ã¨ããã¡ããåãã
Node.jsã§Webãµã¼ã
ä¸è¨ã®è¨äºãããµã³ãã«jsãåç §ããWebãµã¼ããèµ·åãã¦ã¿ãã
//httpã¢ã¸ã¥ã¼ã«ãã¤ã³ãã¼ã var http = require('http'); //Webãµã¼ãã¼ã®è¨å® http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}); res.end('Hello World\n'); }).listen(3000); console.log('Server running at http://localhost:3000/');app.js
 å®è¡ãã¦ã¿ãã
root@STRIKEEAGLE:~# node app.js Server running at http://localhost:3000/
Windowså´ã®ãã©ã¦ã¶ããã¢ã¯ã»ã¹ãÂ
localhostãªãBash on Ubuntu on Windowsã§èµ·åãããã®ã«Windowsããã¢ã¯ã»ã¹ã§ãããã ãª(@_@ãBashå´ã§Ctrl + Cã§ãã®jsãåæ¢ããã¨ããã¢ã¯ã»ã¹ã§ãã¾ãããã«å¤ããã®ã§ééããªãã
Â
çµè«
æ¬çªãLinuxãã·ã³ã§ãWindowsã§Node.jsã¢ããªã®éçºã»ãã¹ãããããªããLinuxã®VMããWindowsã«Node.jsã®ç°å¢ãä½ããããBash on Ubuntu on Windowsã®ã»ãããããããä»ã®ã¨ãããInsider PreviewãããªããBash on Ubuntu on Windowsã¯ä½¿ããªããã©ã

ã·ã³ã°ã«ãã¼ã¸Webã¢ããªã±ã¼ã·ã§ã³ âNode.jsãMongoDBãæ´»ç¨ããJavaScript SPA
- ä½è : Michael S. Mikowski,Josh C. Powell,ä½è¤ç´ç,æ¨ä¸å²ä¹
- åºç社/ã¡ã¼ã«ã¼: ãªã©ã¤ãªã¼ã¸ã£ãã³
- çºå£²æ¥: 2014/05/24
- ã¡ãã£ã¢: 大åæ¬
- ãã®ååãå«ãããã° (1件) ãè¦ã

- ä½è : David Mark Clements,åç°ç¥ä¸é
- åºç社/ã¡ã¼ã«ã¼: ãªã©ã¤ãªã¼ã¸ã£ãã³
- çºå£²æ¥: 2013/02/23
- ã¡ãã£ã¢: 大åæ¬
- è³¼å ¥: 2人 ã¯ãªãã¯: 4å
- ãã®ååãå«ãããã° (5件) ãè¦ã
 åãPCä¸ã«Ubuntuã®VMãä½ã£ã¦ãããã ãã©ãã³ãã³ãã®åãã¯VMã®ã»ããéããããªæ°ãããã
é·ããªã£ãã®ã§å¥ã¨ã³ããªã«ãããã©ãBash on Ubuntu on Windowsä¸ã§ãLoopbackãåãã¡ãã£ãï½ãããã¯æãã