まず、laravel プロジェクトを google container-optimized-os にデプロイしました。
そして、次を実行してビルドを作成しました:
docker-compose up -d
アプリコンテナーへの移動が完了したら、次を実行します。
docker exec -it app bash
次に実行します:
npm install
と
npm run dev
最後に、次のエラーが表示されます。
npm WARN npm npm does not support Node.js v10.19.0 npm WARN npm You should probably upgrade to a newer version of node as we npm WARN npm can't make any promises that npm will work with this version. npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9. npm WARN npm You can find the latest version at https://nodejs.org/ @ dev /var/www npm run development npm WARN npm npm does not support Node.js v10.19.0 npm WARN npm You should probably upgrade to a newer version of node as we npm WARN npm can't make any promises that npm will work with this version. npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9. npm WARN npm You can find the latest version at https://nodejs.org/ @ development /var/www cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js sh: 1: cross-env: Permission denied npm ERR! code ELIFECYCLE npm ERR! errno 126 npm ERR! @ development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js` npm ERR! Exit status 126 npm ERR! npm ERR! Failed at the @ development script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2020-05-10T15_35_07_179Z-debug.log npm ERR! code ELIFECYCLE npm ERR! errno 126 npm ERR! @ dev: `npm run development` npm ERR! Exit status 126 npm ERR! npm ERR! Failed at the @ dev script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2020-05-10T15_35_07_203Z-debug.log
https://www.digitalocean.com/community/tutorials/how-to-set-up-laravel-nginx-and-mysql-with-docker-composedocker-compos.yml
から Dockerfileをコピーします
nodejsとnpmをインストールするためにDockerfileを編集します
ありがとう。