wsl 用 docker 构建 nx monorepo项目异常?

新手上路,请多包涵

我的项目是用nx next搭建的monorepo项目,apps文件夹里面有pc和h5两个子项目;
packag.json:

"build:pc": "sh ./docker.sh pc",
"build:h5": "sh ./docker.sh h5",

docker,sh:

echo 开始构建 $1 代码
yarn build $1
if [ $? -ne 0 ]; then
  echo 镜像打包失败
else
  echo 代码打包完成
  echo 构建docker镜像
  docker build -t (镜像地址,隐私用文字代替)/portal-$1:v${npm_package_version} . --build-arg target=$1
  if [ $? -ne 0 ]; then
    echo 构建镜像失败
  else
    echo docker镜像构建完成
    echo 推送docker镜像
    docker push (镜像地址,隐私用文字代替)/portal-$1:v${npm_package_version}
  fi
fi

wsl 用 docker 构建 执行yarn build:pc 报错。
同事在mac上面是可以正常构建打镜像的,我在window用这个方法就不行

@HIH-D-22592:/d/portal$ yarn build:pc
yarn run v1.22.19
$ sh ./docker.sh pc
开始构建 pc 代码
' nx build 'pc


'>  NX   Cannot find project 'pc

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
./docker.sh: 17: Syntax error: end of file unexpected (expecting "then")
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
阅读 1.8k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题