首先,我在 google container-optimized-os 上部署了我的 laravel 项目。
我通过运行创建了构建:
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-compose复制docker-compos.yml
和 Dockerfile
并编辑 Dockerfile 以安装 nodejs 和 npm
谢谢。