install latest node version in Dockerfile

Viewed 1360

I have a Dockerfile

FROM node:alpine

WORKDIR /usr/app

RUN apk update; \
    apk upgrade;

RUN apk add --update nodejs; \
    apk add --update npm;

RUN npm cache clean -f; \
    npm install n -g; \
    n stable; \
    npm update -g; \
    npm install npm@latest -g;

RUN npm install koa --save; \
    npm install koa-router --save; \
    npm install dotenv --save; \
    npm install koa-cors --save; \
    npm install pm2 --save;

and get error messages:

npm notice npm notice New patch version of npm available! 8.1.0 -> 8.1.2 npm notice Changelog: https://github.com/npm/cli/releases/tag/v8.1.2 npm notice Run npm install -g npm@8.1.2 to update! npm notice env: can't execute 'bash': No such file or directory npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.

0 Answers
Related