新しくパソコンを買ってもらったので、環境作りしていたら、postgresql が動かないので大変こまった。
$ brew install postgresql
==> Downloading https://homebrew.bintray.com/bottles/postgresql-10.4.high_sierra.bottle.tar.gz
Already downloaded: /Users/ninjaninja/Library/Caches/Homebrew/postgresql-10.4.high_sierra.bottle.tar.gz
==> Pouring postgresql-10.4.high_sierra.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink include/pg_config.h
Target /usr/local/include/pg_config.h
already exists. You may want to remove it:
rm '/usr/local/include/pg_config.h'
To force the link and overwrite all conflicting files:
brew link --overwrite postgresql
To list all files that would be deleted:
brew link --overwrite --dry-run postgresql
Possible conflicting files are:
/usr/local/include/pg_config.h
/usr/local/include/pg_config_manual.h
/usr/local/include/pg_config_os.h
おまえかーーー!!!
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
とりあえず権限を変更すれば良いらしいので、chown
$ sudo chown $(whoami) /usr/local
Password:
chown: /usr/local: Operation not permitted
sudoで変更できないんだ。どうしよう。
世界のおともだちによれば、
https://github.com/Homebrew/brew/issues/3228
sudo chown -R $(whoami) $(brew --prefix)/*
/usr/localは諦めて、以下全部自分のにすればよくない?とのこと。いけたわ!
で、ようやくmigrate
$ sequelize db:migrate
Sequelize CLI [Node: 10.5.0, CLI: 4.0.0, ORM: 4.38.0]
Loaded configuration file "config/config.json".
Using environment "development".
ERROR: Please install 'pg' module manually
pg 入ってますがな!!
世界のおともだちによれば、
https://github.com/sequelize/sequelize/issues/6907
「-g で入れたら動いたで」とのことなので試す。
$ npm install -g sequelize sequelize-cli pg --save
/usr/local/bin/sequelize -> /usr/local/lib/node_modules/sequelize-cli/lib/sequelize
+ sequelize-cli@4.0.0
+ sequelize@4.38.0
+ pg@7.4.3
added 15 packages from 9 contributors and updated 2 packages in 2.538s
動きました。ありがとうございました。