kharukaのブログ~お金と技術とキャリア~

Edu Fin~金融×教育~若いうちからお金について学ぶってだいじ!学んだテクノロジーはみんなの財産。過去、現在、将来の人生についてのブログ

はじめてのNode.jsインストール(2019年3月2日更新)

Node.js超入門[第2版]

Node.js超入門[第2版]

エンジニアスクールFLOC

環境情報

OS

OS バージョン 備考
macOS Mojava 10.14.2 ホストOS
Oracle VM VirtualBox 5.2.24
Ubuntu 18.04.1LTS ゲストOS

Node.js

Node.js バージョン 備考
npm 6.4.1
node v8.15.0

環境構築

▼環境構築の仕方はこちらなどをご参考に。

はじめてのCounterpartyノード構築Part1(2018年9月29日更新) - kharukaのブログ~お金と技術とキャリア~

Node.jsのインストール

作業用ディレクトリ作成

mkdir work
cd work

apt update と upgrade

sudo apt update
sudo apt upgrade -y

ライブラリのインストール

sudo apt install -y build-essential

nodejs と npm のインストール

sudo apt install -y curl
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt install -y nodejs

バージョン確認

node -v
 -- v10.15.0 --
npm -v
 -- 6.4.1 --

package.json作成

取り敢えず、全てenterでOK。

$ npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.

See `npm help json` for definitive documentation on these fields
and exactly what they do.

Use `npm install <pkg>` afterwards to install a package and
save it as a dependency in the package.json file.

Press ^C at any time to quit.
package name: (tmp) 
version: (1.0.0) 
description: 
entry point: (index.js) 
test command: 
git repository: 
keywords: 
author: 
license: (ISC) 
About to write to ~/tmp/package.json:

{
  "name": "tmp",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}

bitcoinjs-lib のインストール

npm install bitcoinjs-lib --save

参考

ビットコインとブロックチェーン

ビットコインとブロックチェーン