docker-compose-laravel icon indicating copy to clipboard operation
docker-compose-laravel copied to clipboard

How do i update the browserlist

Open GandalfGrey opened this issue 3 years ago • 2 comments

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

GandalfGrey avatar Nov 21 '21 12:11 GandalfGrey

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

Librasulus avatar Mar 12 '22 13:03 Librasulus

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

GandalfGrey avatar Mar 12 '22 17:03 GandalfGrey