LoginSignup
2
0

More than 1 year has passed since last update.

初めてのvccw環境構築で躓いたあれこれ

Last updated at Posted at 2021-10-11

今回実現したいこと

  • BitBucketのリポジトリからローカル環境へのクローン
  • vccwを用い、OSの環境に依存しないWordPress開発環境を構築する
  • gulpの導入

手順

つまずきポイント

git cloneの際にパスワード入力求められるが設定した覚えがない
Password for ‘https://[ユーザ名]@bitbucket.org’:

原因:BitbucketにGoogle認証でユーザ登録しただけでは、パスワードが発行されない為
対処:Bitbucketのトップページから個人設定でパスワードを発行する
参考サイトBitbucketにGoogle認証している人はcloneためにパスワードを発行しましょう

VirtualBox起動時のエラー
VirtualBox COMオブジェクトの確保に失敗しました。アプリケーションを終了します。

Document is empty.
Location: ‘/Users/ユーザ名/Library/VirtualBox/VirtualBox.xml’, line 1 (0), column 1.
/Users/vbox/tinderbox/6.1-mac-rel/src/VBox/Main/src-server/VirtualBoxImpl.cpp[740] (nsresult VirtualBox::init()).

原因:VirtualBox.xmlファイルの中身が空になっていた
対処
1. rmコマンドでVirtualBox.xmlを削除 
2. VirtualBox.xml-prevというバックアップファイルをVirtualBox.xmlという名前に更新する

vagrant upでのエラー①
A Vagrant environment or target machine is required to run this
command. Run `vagrant init` to create a new Vagrant environment. Or,
get an ID of a target machine from `vagrant global-status` to run
this command on. A final option is to change to a directory with a
Vagrantfile and to try again.

原因: カレントディレクトリの相違
対処: Vagrantfileがあるディレクトリへ移動してから再実行

vagrant upでのエラー②
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["import", "/Users/ユーザ名/.vagrant.d/boxes/vccw-team-VAGRANTSLASH-xenial64/
20180107/virtualbox/box.ovf", "--vsys", "0", "--vmname", "vccw-xenial64_default_1515
273345584_52233_1633075723925_27924", "--vsys", "0", "--unit", "13", "--disk",
"/Users/ユーザ名/VirtualBox VMs/vccw-xenial64_default_1515273345584_52233_1633075723925_27924/box-disk001.vmdk"]

原因: ホストOS側の容量不足(importコマンドでエラーが発生した場合は読み込み周りを疑う!)
対処: ストレージ開放し、空き容量を確保する。

vagrant upでのエラー③
default: Warning: Authentication failure. Retrying…

原因: VMで生成されるSSH秘密鍵とゲストOS上のSSH公開鍵の不一致
対処: SSH秘密鍵から公開鍵を生成し、ゲストOSで設定されている公開鍵を書き換える。

  1. 秘密鍵を確認
    $ vagrant ssh-config => IdentityFileに表示される部分が秘密鍵ファイル
  2. 秘密鍵ファイルを用いて、公開鍵を生成する
    $ ssh-keygen -yf ****/vagrant_private_key > public_key
  3. vagrant sshでログインし、authorized_keysの公開鍵の情報を先ほど生成した公開鍵の中身に置き換える。
    $ vi /home/vagrant/.ssh/authorized_keys
  4. vagrantの再起動
    $ vagrant reload

vagrant upでのエラー④
TASK [Download the Composer] ***************************************************
fatal: [****.local]: FAILED! => {"changed": false, "failed": true, "msg": "Failed to validate the SSL certificate for [getcomposer.org:443](<http://getcomposer.org:443/>). Make sure your managed systems have a valid CA certificate installed. You can use validate_certs=False if you do not need to confirm the servers identity but this is unsafe and not recommended. Paths checked for this platform: /etc/ssl/certs, /etc/pki/ca-trust/extracted/pem, /etc/pki/tls/certs, /usr/share/ca-certificates/cacert.org, /etc/ansible. The exception msg was: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)."}
to retry, use: --limit @/vagrant/provision/playbook.retry

PLAY RECAP *********************************************************************
****.local            : ok=4    changed=3    unreachable=0    failed=1

Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.

ansibleで失敗しているとのことだったので、一度これを削除し、最新版を再インストール!
$ brew uninstall ansible —force
$ brew install ansible

…しかし直らず(インストールにはかなり時間が掛かりました)。

原因:おそらくcloneしてきたファイルからvagrant initにて自動生成されたVagrantfileの設定が、現在のバージョンと合わなかったため。
対処VCCWの.zipフォルダから取得してきたデフォルトのVagrantfileを使用する

npm install -gでのエラー
pm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access ‘/usr/local/lib/node_modules’
npm ERR!  [Error: EACCES: permission denied, access ‘/usr/local/lib/node_modules’] {
npm ERR!   errno: -13,
npm ERR!   code: ‘EACCES’,
npm ERR!   syscall: ‘access’,
npm ERR!   path: ‘/usr/local/lib/node_modules’
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running

原因: npmのパスを通す(=プログラム名だけで実行できるようにする)必要がある
対処
1. $ mkdir ~/.npm-global
2. $ npm config set prefix '~/.npm-global'
3. $ echo ' export PATH=~/.npm-global/bin:$PATH' >> ~/.bash_profile
4. $ source ~/.bash_profile
5. $ npm install -g gulp

最後に

かなり初歩的なミスも散見されると思いますが、自戒の念を込めて記録しておくことにしました。
何か間違いなどありましたら、そっとお伝えください!

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0