Angular4 を Udemy で学んでみる。
環境は勉強用に、vagrantでcentos 7.3環境を作成。今の環境は汚したくないので。
d:\vagrant
mkdir angular4-centos
cd angu*
copy ..\centos\Vagrantfile . ←開発環境用のVagrantfileはここに置いてある。
vagrant up
で、centos7.3 環境をさくっと新規に立ち上げる。便利な世の中になったもんだ。
vagrantユーザでログイン。一応パスワードは変えておく。
centos7 へのインストールは、公式サイトの手順に従う。
https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora
LTS(Long Term Support)バージョンを入れることにする。
curl --silent --location https://rpm.nodesource.com/setup_6.x | sudo bash -
sudo yum -y install nodejs
一応公式サイトにある Optional: な手順も実行
sudo yum install gcc-c++ make
で、いよいよ angular4.
angular cli のサイト https://cli.angular.io/ の通り、
$ npm install -g @angular/cli
でインストール
あれ? linux x64 はサポートされてない? エラーになった。
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! Linux 3.10.0-229.el7.x86_64
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "-g" "@angular/cli"
npm ERR! node v6.11.4
npm ERR! npm v3.10.10
npm ERR! path /usr/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/lib/node_modules'
npm ERR! at Error (native)
npm ERR! { Error: EACCES: permission denied, access '/usr/lib/node_modules'
npm ERR! at Error (native)
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/lib/node_modules' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Please include the following file with any support request:
npm ERR! /home/vagrant/npm-debug.log
あー。 root ならいけるのか? スーパユーザになってやり直す。
# npm install -g @angular/cli
npm install -g @angular/cli
/usr/bin/ng -> /usr/lib/node_modules/@angular/cli/bin/ng
> node-sass@4.5.3 install /usr/lib/node_modules/@angular/cli/node_modules/node-sass
> node scripts/install.js
Downloading binary from https://github.com/sass/node-sass/releases/download/v4.5.3/linux-x64-48_binding.node
Download complete ] - :
Binary saved to /usr/lib/node_modules/@angular/cli/node_modules/node-sass/vendor/linux-x64-48/binding.node
Caching binary to /root/.npm/node-sass/4.5.3/linux-x64-48_binding.node
Failed to cache binary: { Error: EACCES: permission denied, open '/root/.npm/node-sass/4.5.3/linux-x64-48_binding.node'
at Error (native)
errno: -13,
code: 'EACCES',
syscall: 'open',
path: '/root/.npm/node-sass/4.5.3/linux-x64-48_binding.node' }
> uglifyjs-webpack-plugin@0.4.6 postinstall /usr/lib/node_modules/@angular/cli/node_modules/uglifyjs-webpack-plugin
> node lib/post_install.js
なんか気になるエラー(Failed to cache binary: ) はあるが、インストールはされたかな?
・一応 node-sass がエラーになっているのも気持ち悪いので、個別に node-sass をインストールしておく。
# npm install -g node-sass
v4.5.3/linux-x64-48_binding.nodeがダウンロードされてインストールされたようなので良しとして先に進む。
一応、一般ユーザにもどって、$ ng version としてみる。
$ ng version
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
@angular/cli: 1.4.9
node: 6.11.4
os: linux x64
とりま OK のよう。
コメント
コメントを投稿