LoginSignup
2
1

More than 5 years have passed since last update.

heroku docker:execしたらnpm install出来なくなった場合

Posted at

herokuでdockerが使えるようになったので、触ってみた。

git clone https://github.com/heroku/node-js-getting-started.git
heroku plugins:install heroku-docker
heroku docker:init
heroku docker:start

簡単。

で、npmモジュールを追加しようと思って、以下を実行した。
heroku docker:exec npm install request --save

そうするとこんなエラー。
Error: EACCES, mkdir '/app/src/node_modules/express'
パーミッションがないっぽい。

解決策としては、ホスト側で生成されているnode_modulesディレクトリを削除すれば良い。

heroku docker:execで実行したコマンドによる変更は、ホスト側にも反映されるので、npm installを実行するとnode_modulesディレクトリが生成される。これがコンテナ上にCOPYされていて、docker上のユーザが触れなくなってたみたい。

2
1
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
1