0

I want to run a app on heroku using Dockerfile but it can`t run npm intsall

This is my Dockerfile:

FROM ubuntu:18.04
RUN apt-get update && apt-get upgrade -y && \
    apt-get install -y nodejs \
    npm
RUN apt-get update && \
    apt-get install -y \
    ffmpeg \
    imagemagick \
    webp && \
    apt-get upgrade -y && \
    rm -rf /var/lib/apt/lists/*
COPY package.json .
RUN npm install
CMD ["node", "index.js"]

and this is error:

npm ERR! typeerror Error: Missing required argument #1
npm ERR! typeerror     at andLogAndFinish (/usr/share/npm/lib/fetch-package-metadata.js:31:3)
npm ERR! typeerror     at fetchPackageMetadata (/usr/share/npm/lib/fetch-package-metadata.js:51:22)
npm ERR! typeerror     at resolveWithNewModule (/usr/share/npm/lib/install/deps.js:456:12)
npm ERR! typeerror     at /usr/share/npm/lib/install/deps.js:457:7
npm ERR! typeerror     at /usr/share/npm/node_modules/iferr/index.js:13:50
npm ERR! typeerror     at /usr/share/npm/lib/fetch-package-metadata.js:37:12
npm ERR! typeerror     at addRequestedAndFinish (/usr/share/npm/lib/fetch-package-metadata.js:82:5)
npm ERR! typeerror     at returnAndAddMetadata (/usr/share/npm/lib/fetch-package-metadata.js:117:7)
npm ERR! typeerror     at pickVersionFromRegistryDocument (/usr/share/npm/lib/fetch-package-metadata.js:134:20)
npm ERR! typeerror     at /usr/share/npm/node_modules/iferr/index.js:13:50
npm ERR! typeerror This is an error with npm itself. Please report this error at:
npm ERR! typeerror     <http://github.com/npm/npm/issues>
WARN engine mongoose@6.6.2: wanted: {"node":">=12.0.0"} (current: {"node":"8.10.0","npm":"3.5.2"})
npm ERR! Please include the following file with any support request:
npm ERR!     /npm-debug.log
The command '/bin/sh -c npm install' returned a non-zero code: 1

This is my app github reposity. Run using heroku.

Any idea how to solve this problem?

m19v
  • 1,800
  • 4
  • 11
  • 26
Nothing
  • 1
  • 1
  • use better one of the official node images: `https://hub.docker.com/_/node` – Mihai Sep 27 '22 at 12:28
  • [Unsupported engine node / NPM only when building in Docker](https://stackoverflow.com/questions/57924847/unsupported-engine-node-npm-only-when-building-in-docker) also suggests using a `node` image. Ubuntu 18.04 is a little dated at this point, plus the standard Linux distributions tend to be slightly behind in versions of language runtimes they package, so with this Dockerfile I wouldn't be surprised to see a 5-year-old Node version that causes conflicts with newer packages. – David Maze Sep 27 '22 at 13:25
  • Can you send me right DockerFile source codes please? – Nothing Sep 27 '22 at 21:32

0 Answers0