I have configured a PHP image for my Bitbucket's Pipelines that runs scripts thru a YML file. I have a laravel repository and want to execute a build command.
Though the problem is that on my script, when it runs the npm install
, it fails.
bash: npm: command not found
# This is a sample build configuration for PHP.
# Check our guides at https://confluence.atlassian.com/x/e8YWN for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: php:7.1.1
pipelines:
default:
- step:
caches:
- composer
script:
- apt-get update && apt-get install -y unzip
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
- composer install
- npm install --global gulp-cli
- npm install
- gulp --production
This should help. It'll install Node v8 and NPM v5. Put it before npm install --global gulp-cli
script:
- curl -sL https://deb.nodesource.com/setup_8.x | bash -
- apt-get install -y nodejs
You are using the
image: php:7.1.1 docker image.
Which does not contain nodejs and npm. As you can see here in the Dockerfile:
https://github.com/docker-library/php/blob/eadc27f12cfec58e270f8e37cd1b4ae9abcbb4eb/7.1/Dockerfile
Either:
install the dependencies with the package manager as mentioned by @mazedlx
use another dockerimage containing npm and nodejs, like this one: https://hub.docker.com/r/_/node/
image: php:7.1.1
with f.e. image: node:latest
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With