Reputation: 2243
Installing the Laravel 5.7 application in Docker, I need to install npm/nodejs and for this in my web/Dockerfile.yml, I added lines for Node.js:
FROM php:7.2-apache
RUN apt-get update && \
apt-get install -y \
python \
libfreetype6-dev \
libwebp-dev \
libjpeg62-turbo-dev \
libpng-dev \
nano \
git-core \
curl \
build-essential \
openssl \
libssl-dev \
libgmp-dev \
libldap2-dev \
netcat \
sqlite3 \
libsqlite3-dev \
&& git clone https://github.com/nodejs/node.git \
&& cd node \
&& ./configure \
&& make \
&& make install
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-webp-dir=/usr/include/ --with-jpeg-dir=/usr/include/
RUN docker-php-ext-install gd pdo pdo_mysql pdo_sqlite zip gmp bcmath pcntl ldap sysvmsg exif \
&& a2enmod rewrite
COPY virtualhost.conf /etc/apache2/sites-enabled/000-default.conf
Running
docker-compose up -d --build
The command had a long output and all was run OK.
But entering the shell, I found that I don't have any Node.js, as I expected by installing node.git (as root):
cd /var/www/html
npm -v
Output:
6.11.3
And:
nodejs -v
Output:
bash: nodejs: command not found
/var/www/html# composer install
bash: composer: command not found
What is wrong?
Upvotes: 0
Views: 367
Reputation: 60114
Use node -v
instead of nodejs
.
-v, --version print Node.js version
Or you can explore further options using
node --help
During build time
RUN node --version
Test Node Version
To see if Node is installed, type
node -v
in Terminal. This should print the version number so you’ll see something like thisv<version>
.
Upvotes: 2