yarn install error在Docker构build过程中找不到package.json

纱线版本:0.21.2

Nodejs版本:6.9和4.7

在本地运行纱线时,它可以工作

当运行npm安装它的作品

当运行yarn安装Dockerfile(docker docker build . )时,它会失败: error Couldn't find a package.json file in "/root/.cache/yarn/npm-readable-stream-2.2.2-a9e6fec3c7dda85f8bb1b3ba7028604556fc825e"

我完全不知道为什么。

 Step 16 : RUN yarn install ---> Running in 917c2b1b57fb yarn install v0.21.2 [1/4] Resolving packages... [2/4] Fetching packages... error Couldn't find a package.json file in "/root/.cache/yarn/npm-readable-stream-2.2.2-a9e6fec3c7dda85f8bb1b3ba7028604556fc825e" info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command. The command '/bin/sh -c yarn install' returned a non-zero code: 1 

Yarn在Dockerfile中以这种方式安装。RUN RUN curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 0.21.2 ENV PATH /root/.yarn/bin:$PATH RUN curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 0.21.2 ENV PATH /root/.yarn/bin:$PATH