sh:lerna:使用docker运行应用程序时找不到

时间:2019-10-27 01:25:20

标签: javascript node.js docker

我正在尝试使用docker file在演示下方运行。

https://github.com/OpusCapita/fsm-workflow

我的docker file

# Docker context should be "<repo-root>"

FROM node:8-alpine
LABEL maintainer="OpusCapita"

ENV HOST 0.0.0.0
ENV PORT 3020

COPY ./ /demo

WORKDIR /demo

RUN npm i --unsafe-perm && \
  cd ./packages/examples/complete-demo && \
  npm run demo:build

WORKDIR /demo/packages/examples/complete-demo

CMD ["npm", "run", "demo:start"]

EXPOSE $PORT
© 2019 GitHub, Inc.

在部署时遇到此错误。

sh: lerna: not found

npm ERR! file sh

日志

Building image...
Step 1/10 : FROM node:8-alpine


 ---> e8b2a6e1bbd7

Step 2/10 : LABEL maintainer="OpusCapita"


 ---> Using cache

 ---> 2ee8a0ffc36f

Step 3/10 : ENV HOST 0.0.0.0


 ---> Using cache

 ---> 3980c8fcd99c

Step 4/10 : ENV PORT 3020


 ---> Using cache

 ---> 04cd54009ba2

Step 5/10 : COPY ./ /demo


 ---> b321c3cc1ac5

Step 6/10 : WORKDIR /demo


 ---> Running in fbf59913ad9b

Removing intermediate container fbf59913ad9b

 ---> 1cd94112afd1

Step 7/10 : RUN npm i --unsafe-perm && npm install -g rimraf && npm install --g lerna &&   cd ./packages/examples/complete-demo &&   npm run demo:build


 ---> Running in 35dceefe2cb8


> @opuscapita/fsm-workflow@ postinstall /demo
> npm run bootstrap



> @opuscapita/fsm-workflow@ bootstrap /demo
> lerna bootstrap


sh: lerna: not found

npm ERR! file sh

npm ERR!
 code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn

npm ERR!
 @opuscapita/fsm-workflow@ bootstrap: `lerna bootstrap`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the @opuscapita/fsm-workflow@ bootstrap script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

1 个答案:

答案 0 :(得分:0)

lerna.json的行尾更改为UNIX(LF),然后再次运行。

如果您再次遇到其他文件的类似错误,则再次运行时,这表示我们已发现问题(行尾)。

我建议在Dockerfile内的文件夹中为所有dos2unixJSONtxtjs文件运行html或类似功能。 / p>