Docker Community Forums

Share and learn in the Docker community.

How to add npm into docker project based on apache?


#1

Hello,

How correctly add npm / nodejs to my php 7.2 / laravel 5 docker project based on php:7.2-apache ?

In my web/Dockerfile.yml I added line with " nodejs ":

FROM php:7.2-apache

RUN apt-get update && \
    apt-get install -y \
    libfreetype6-dev \
    libwebp-dev \
    libjpeg62-turbo-dev \
    libpng-dev \
    nano \
    libgmp-dev \
    libldap2-dev \
    netcat \
    sqlite3 \
    nodejs \
    git \
    libsqlite3-dev && \
    docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-webp-dir=/usr/include/  --with-jpeg-dir=/usr/include/ && \
    docker-php-ext-install gd pdo pdo_mysql pdo_sqlite zip gmp bcmath pcntl ldap sysvmsg exif \
&& a2enmod rewrite

and running command :

docker-compose up -d --build

I did not get any errors during installation and I entered the bash, but failed testing

$ docker-compose exec web bash
root@beef5dec0a0b:/var/www/html# npm -v
bash: npm: command not found
root@beef5dec0a0b:/var/www/html# node -v
bash: node: command not found

I tried to add npm in the listing above, but got error that no candidate found…

Tnanks in advance!


#2

I still search for decision. No ideas?