docker-compose-laravel
docker-compose-laravel copied to clipboard
How do i update the browserlist
When i run docker-compose run --rm npm run dev it complains about Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db
But when i tried to run docker-compose run --rm npx browserslist@latest --update-db it fails 'no such service: npx'
I haven't been able to find the answer
I had the same issue and managed to solve it.
npx is already included in the npm image, however it runs as a separate command. In order to run it you have to remove the entrypoint parameter at the docker-compose.yml file. So the npm service turns into: npm: image: node:13.7 container_name: npm volumes: - ./src:/var/www/html ports: - 3000:3000 - 3001:3001 working_dir: /var/www/html
After that you can use npx by: docker-compose run --rm npm npx
Take into account that this also changes the way you run npm. The respective npm should change into (i.e.): docker-compose run --rm npm npm run development
My solution was to add "browserlist": "npx browserslist@latest --update-db" to the scripts section in the package.json file.
Then using docker-compose run --rm npm run browserlist