我在docker中遇到了這個錯誤:
npm ERR! enoent ENOENT: no such file or directory, open
'/home/dan/repos/test_11/wp-content/themes/twentytwentyone/package.json'
這是我的 docker-compose.yml 檔案:
version: "3.9"
services:
npm:
image: node:16.13.2
container_name: dan_npm
volumes:
- "./app:/home/dan/repos/test_11/wp-content/themes/twentytwentyone"
working_dir: "/home/dan/repos/test_11/wp-content/themes/twentytwentyone"
entrypoint: [ 'npm', 'start' ]
我想念什么?
來自專案檔案夾樹的影像
uj5u.com熱心網友回復:
您的問題是您將 /app 和所有內容安裝在容器內路徑的末尾。所以你在重復這條路。
通過做這個。
volumes:
# mounts app and everything inside at the location after the colon
- ./app:/home/dan/repos/test_11/wp-content/themes/twentytwentyone
容器內的最終路徑將是這個。
/home/dan/repos/test_11/wp-content/themes/twentytwentyone/wp-content/themes/twentytwentyone/
我建議安裝這樣的東西。
working_dir: /twentytwentyone
volumes:
# mount only the relevant folder (the last one) inside /app
# to some location, not as deeply nested for convinience
- ./app/wp-content/themes/twentytwentyone:/twentytwentyone
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/417553.html
標籤:
