入門Reactを読んでいます。
サンプルコードを動かしながら、読み進めていくのですが、サンプルコードのinstallでハマったので、共有します。
ndenvでversionを指定するのがポイントです。
基本的に、付録A P228の手順に従います。
- オライリー・ジャパンのサイトから、日本語版のサンプルコードをdonwload。
- 解凍
unzip survey_builder.zip
- ディレクトリ移動
cd survey_builder_150312
- nodeのversionを指定。(ndenv利用)
$ ndenv local v0.10.41
$ node -v
v0.10.41
- npmは最新を利用
$ npm -v
3.5.3
- install
$ npm install
npm install
npm WARN deprecated lodash-node@2.4.1: This package is no longer maintained. See its readme for upgrade details.
npm WARN deprecated react-tools@0.11.2: react-tools is deprecated. For more information, visit https://fb.me/react-tools-deprecated
npm WARN deprecated karma-bro@0.6.2: Renamed karma-browserify as of 1.0
npm WARN deprecated npmconf@2.1.1: this package has been reintegrated into npm and is now out of date with respect to npm
npm WARN deprecated CSSselect@0.4.1: the module is now available as 'css-select'
npm WARN deprecated CSSwhat@0.4.7: the module is now available as 'css-what'
> fsevents@1.0.6 install /Users/snumano/Documents/Javascript/React/survey_builder_150312/node_modules/fsevents
> node-pre-gyp install --fallback-to-build
[fsevents] Success: "/Users/snumano/Documents/Javascript/React/survey_builder_150312/node_modules/fsevents/lib/binding/Release/node-v11-darwin-x64/fse.node" is installed via remote
> fsevents@0.2.1 install /Users/snumano/Documents/Javascript/React/survey_builder_150312/node_modules/watchify/node_modules/fsevents
> node-gyp rebuild
CXX(target) Release/obj.target/fse/fsevents.o
SOLINK_MODULE(target) Release/fse.node
> phantomjs@1.9.19 install /Users/snumano/Documents/Javascript/React/survey_builder_150312/node_modules/phantomjs
> node install.js
PhantomJS not found on PATH
Download already available at /var/folders/vk/wgk8gyf52tl1ly68pnp0md3m0000gn/T/phantomjs/phantomjs-1.9.8-macosx.zip
Verified checksum of previously downloaded file
Extracting zip contents
Removing /Users/snumano/Documents/Javascript/React/survey_builder_150312/node_modules/phantomjs/lib/phantom
Copying extracted folder /var/folders/vk/wgk8gyf52tl1ly68pnp0md3m0000gn/T/phantomjs/phantomjs-1.9.8-macosx.zip-extract-1452994290803/phantomjs-1.9.8-macosx -> /Users/snumano/Documents/Javascript/React/survey_builder_150312/node_modules/phantomjs/lib/phantom
Writing location.js file
Done. Phantomjs binary available at /Users/snumano/Documents/Javascript/React/survey_builder_150312/node_modules/phantomjs/lib/phantom/bin/phantomjs
---snip---
npm WARN bleeding-edge-sample-app@0.0.1 license should be a valid SPDX license expression
- build
$ npm run build
> bleeding-edge-sample-app@0.0.1 build /Users/snumano/Documents/Javascript/React/survey_builder_150312
> browserify -t reactify client/client.js > public/build/bundle.js --debug
- start
$ npm start
> bleeding-edge-sample-app@0.0.1 prestart /Users/snumano/Documents/Javascript/React/survey_builder_150312
> npm run-script build
> bleeding-edge-sample-app@0.0.1 build /Users/snumano/Documents/Javascript/React/survey_builder_150312
> browserify -t reactify client/client.js > public/build/bundle.js --debug
> bleeding-edge-sample-app@0.0.1 start /Users/snumano/Documents/Javascript/React/survey_builder_150312
> node server/server.js
App started goto - http://0.0.0.0:8080
- ブラウザで確認。
npm install
時にいろいろメッセージが表示されましたが、とりあえず動作しているようなので、これでokとします。