Friday, August 23, 2019

sh: vue-cli-service: not found or sh: tslint: not found in docker-compose

While running docker-compose with vue.js application, It keeps throwing error as following

  1.  web_1     | sh: vue-cli-service: not found
  2.  server_1  | > tslint -c tslint.json -p tsconfig.json --fix
It is found that While running the docker-compose the path to the vue-cli-service/tslint is not found.

Solution:

  • Install the vue cli as global in Dockerfile as follows.
  • Include the path to the bat/exe to the docker environment path as follows.
Sample Dockerfile:

FROM node:12.2.0-alpine
WORKDIR /app
COPY . /app
ENV PATH /app/node_modules/.bin:$PATH
RUN npm install -g typescript
RUN npm install -g tslint
RUN npm install
CMD ["npm", "run","start"]