Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

/bin/sh: 1: [“npm”,: not found on docker-compose up [duplicate]

I'm new to docker and trying to create a container for node apps.

I followed these tutorial, but on docker-compose up I'm getting always these error:

Creating app ... done
Attaching to app
app    | /bin/sh: 1: [“npm”,: not found
app exited with code 127

Here is my Dockerfile:

FROM node:latest
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY package.json /usr/src/app/
COPY package-lock.json /usr/src/app/
RUN npm install
COPY . /usr/src/app
EXPOSE 3000
CMD ["npm", "start"]

and my docker-compose.yml:

version: "2"
services:
  app:
    container_name: app
    restart: always
    build: .
    ports:
      - "3000:3000"

Has anyone an idea how to fix this error?

like image 462
Nio Avatar asked Jan 10 '18 16:01

Nio


1 Answers

You have the wrong quotes in your dockerfile:

app    | /bin/sh: 1: [“npm”,: not found

doesn't match the quotes in the example you pasted:

CMD ["npm", "start"]

Double check your Dockerfile to correct your quotes.

like image 134
BMitch Avatar answered Oct 04 '22 22:10

BMitch