Giving /bin/sh: 1: [npm,: not found error after build
sundar-oroPRO
6 months ago
Below docker file giving Error: /bin/sh: 1: [npm,: not found error after build
Use the official Node.js 20 image as the base
FROM node:20
Set the working directory inside the container
WORKDIR /usr/src/app
Copy package.json and package-lock.json (if available)
COPY package*.json ./
Install dependencies
RUN npm install
Install FFmpeg
RUN apt-get update && apt-get install -y ffmpeg && apt-get clean && rm -rf /var/lib/apt/lists/*
Copy the rest of the application files
COPY . .
Expose the port used by the Hono server
EXPOSE 3000
Command to run the application
CMD [npm, run, start]
ⓘ Deployment information is only viewable by project members and Railway employees.
2 Replies
6 months ago
You forgot the quotes in the CMD
directive -
# Use the official Node.js 20 image as the base
FROM node:20
# Set the working directory inside the container
WORKDIR /usr/src/app
# Copy package.json and package-lock.json (if available)
COPY package*.json ./
# Install dependencies
RUN npm ci
# Install FFmpeg
RUN apt-get update && apt-get install -y ffmpeg && apt-get clean && rm -rf /var/lib/apt/lists/*
# Copy the rest of the application files
COPY . ./
# Expose the port used by the Hono server
EXPOSE 3000
# Command to run the application
CMD ["npm", "run", "start"]
Status changed to Awaiting User Response railway[bot] • 6 months ago
Status changed to Awaiting Railway Response railway[bot] • 6 months ago
Status changed to Solved brody • 6 months ago