nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.63k stars 2.36k forks source link

Workspace creation failure on node:alpine container #2233

Closed hadrien-toma closed 4 years ago

hadrien-toma commented 4 years ago

Description

I am facing the following issues when attempting to create a workspace on a node:alpine based container. The container is running on Kubernetes. I precise all of this because it works when simply doing:

docker run --env "NG_CLI_ANALYTICS=ci" -it node:alpine /bin/sh -c "mkdir /home/node/tmp ; cd /home/node/tmp ; npx create-nx-workspace@latest workspace --cli=angular --interactive=false --npm-scope=test --preset=empty --skipGit=true --skipInstall=false --style=scss"

So it seems that this part of the context matters here :thinking:. Besides, if I use the image directly with Docker, it works. So the errors happen only when running on Kubernetes where the workspace destination is mounted as hostPath, so maybe is there some permissions related underlying issue? :persevere:

Scenarios

npm

> npm init nx-workspace@latest workspace-npm --cli=angular --interactive=false --npm-scope=test --preset=empty --skipGit=true --skipInstall=false --style=scss

npx: installed 167 in 30.557s
Creating a sandbox with Nx...
new workspace-npm "--interactive=false" "--npm-scope=test" "--skipGit=true" "--skipInstall=false" "--style=scss" --preset="empty" --collection=@nrwl/workspace
CREATE workspace-npm/nx.json (181 bytes)
CREATE workspace-npm/tsconfig.json (475 bytes)
CREATE workspace-npm/README.md (2737 bytes)
CREATE workspace-npm/.editorconfig (245 bytes)
CREATE workspace-npm/.gitignore (503 bytes)
CREATE workspace-npm/.prettierignore (74 bytes)
CREATE workspace-npm/.prettierrc (25 bytes)
CREATE workspace-npm/angular.json (90 bytes)
CREATE workspace-npm/package.json (1121 bytes)
CREATE workspace-npm/apps/.gitkeep (1 bytes)
CREATE workspace-npm/libs/.gitkeep (0 bytes)
CREATE workspace-npm/tools/tsconfig.tools.json (204 bytes)
CREATE workspace-npm/tools/schematics/.gitkeep (0 bytes)
CREATE workspace-npm/.vscode/extensions.json (143 bytes)
npm WARN rollback Rolling back minimist@1.2.0 failed (this is probably harmless): Unknown system error -526: Unknown system error -526, rmdir '/repo/workspaces/nx/workspace/tmp/workspace-npm/node_modules/@nrwl/tao/node_modules/minimist'
npm ERR! code Unknown system error -526
npm ERR! syscall rmdir
npm ERR! path /repo/workspaces/nx/workspace/tmp/workspace-npm/node_modules/@nrwl/tao/node_modules/minimist
npm ERR! errno -526
npm ERR! Unknown system error -526: Unknown system error -526, rmdir '/repo/workspaces/nx/workspace/tmp/workspace-npm/node_modules/@nrwl/tao/node_modules/minimist'
npm ERR! A complete log of this run can be found in:
npm ERR!     /home/node/.npm/_logs/2019-12-23T11_11_25_914Z-debug.log
Package install failed, see above.
(node:367) UnhandledPromiseRejectionWarning: Error: Command failed: "/tmp/tmp-367Iu8eFn6TGfH5/node_modules/.bin/ng" new workspace-npm "--interactive=false" "--npm-scope=test" "--skipGit=true" "--skipInstall=false" "--style=scss" --preset="empty" --collection=@nrwl/workspace
    at checkExecSyncError (child_process.js:610:11)
    at Object.execSync (child_process.js:646:15)
    at createApp (/home/node/.npm/_npx/334/lib/node_modules/create-nx-workspace/bin/create-nx-workspace.js:356:21)
    at /home/node/.npm/_npx/334/lib/node_modules/create-nx-workspace/bin/create-nx-workspace.js:74:21
(node:367) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:367) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

npx

> npx create-nx-workspace@latest workspace-npx --cli=angular --interactive=false --npm-scope=test --preset=empty --skipGit=true --skipInstall=false --style=scss

npx: installed 167 in 22.383s
Creating a sandbox with Nx...
new workspace-npx "--interactive=false" "--npm-scope=test" "--skipGit=true" "--skipInstall=false" "--style=scss" --preset="empty" --collection=@nrwl/workspace
CREATE workspace-npx/nx.json (181 bytes)
CREATE workspace-npx/tsconfig.json (475 bytes)
CREATE workspace-npx/README.md (2737 bytes)
CREATE workspace-npx/.editorconfig (245 bytes)
CREATE workspace-npx/.gitignore (503 bytes)
CREATE workspace-npx/.prettierignore (74 bytes)
CREATE workspace-npx/.prettierrc (25 bytes)
CREATE workspace-npx/angular.json (90 bytes)
CREATE workspace-npx/package.json (1121 bytes)
CREATE workspace-npx/apps/.gitkeep (1 bytes)
CREATE workspace-npx/libs/.gitkeep (0 bytes)
CREATE workspace-npx/tools/tsconfig.tools.json (204 bytes)
CREATE workspace-npx/tools/schematics/.gitkeep (0 bytes)
CREATE workspace-npx/.vscode/extensions.json (143 bytes)
npm WARN rollback Rolling back minimist@1.2.0 failed (this is probably harmless): Unknown system error -526: Unknown system error -526, rmdir '/repo/workspaces/nx/workspace/tmp/workspace-npx/node_modules/@nrwl/tao/node_modules/minimist'
npm ERR! code Unknown system error -526
npm ERR! syscall rmdir
npm ERR! path /repo/workspaces/nx/workspace/tmp/workspace-npx/node_modules/@nrwl/tao/node_modules/minimist
npm ERR! errno -526
npm ERR! Unknown system error -526: Unknown system error -526, rmdir '/repo/workspaces/nx/workspace/tmp/workspace-npx/node_modules/@nrwl/tao/node_modules/minimist'
npm ERR! A complete log of this run can be found in:
npm ERR!     /home/node/.npm/_logs/2019-12-23T11_13_17_692Z-debug.log
Package install failed, see above.
(node:466) UnhandledPromiseRejectionWarning: Error: Command failed: "/tmp/tmp-466gYhqxdsGQlG4/node_modules/.bin/ng" new workspace-npx "--interactive=false" "--npm-scope=test" "--skipGit=true" "--skipInstall=false" "--style=scss" --preset="empty" --collection=@nrwl/workspace
    at checkExecSyncError (child_process.js:610:11)
    at Object.execSync (child_process.js:646:15)
    at createApp (/home/node/.npm/_npx/466/lib/node_modules/create-nx-workspace/bin/create-nx-workspace.js:356:21)
    at /home/node/.npm/_npx/466/lib/node_modules/create-nx-workspace/bin/create-nx-workspace.js:74:21
(node:466) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:466) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

yarn

> yarn create nx-workspace workspace-yarn --cli=angular --interactive=false --npm-scope=test --preset=empty --skipGit=true --skipInstall=false --style=scss

yarn create v1.21.1
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed "create-nx-workspace@8.9.0" with binaries:
      - create-nx-workspace
Creating a sandbox with Nx...
new workspace-yarn "--interactive=false" "--npm-scope=test" "--skipGit=true" "--skipInstall=false" "--style=scss" --preset="empty" --collection=@nrwl/workspace
CREATE workspace-yarn/nx.json (181 bytes)
CREATE workspace-yarn/tsconfig.json (475 bytes)
CREATE workspace-yarn/README.md (2739 bytes)
CREATE workspace-yarn/.editorconfig (245 bytes)
CREATE workspace-yarn/.gitignore (503 bytes)
CREATE workspace-yarn/.prettierignore (74 bytes)
CREATE workspace-yarn/.prettierrc (25 bytes)
CREATE workspace-yarn/angular.json (90 bytes)
CREATE workspace-yarn/package.json (1122 bytes)
CREATE workspace-yarn/apps/.gitkeep (1 bytes)
CREATE workspace-yarn/libs/.gitkeep (0 bytes)
CREATE workspace-yarn/tools/tsconfig.tools.json (204 bytes)
CREATE workspace-yarn/tools/schematics/.gitkeep (0 bytes)
CREATE workspace-yarn/.vscode/extensions.json (143 bytes)
npm WARN rollback Rolling back minimist@1.2.0 failed (this is probably harmless): Unknown system error -526: Unknown system error -526, rmdir '/repo/workspaces/nx/workspace/tmp/workspace-yarn/node_modules/@nrwl/tao/node_modules/minimist'
npm ERR! code Unknown system error -526
npm ERR! syscall rmdir
npm ERR! path /repo/workspaces/nx/workspace/tmp/workspace-yarn/node_modules/@nrwl/tao/node_modules/minimist
npm ERR! errno -526
npm ERR! Unknown system error -526: Unknown system error -526, rmdir '/repo/workspaces/nx/workspace/tmp/workspace-yarn/node_modules/@nrwl/tao/node_modules/minimist'
npm ERR! A complete log of this run can be found in:
npm ERR!     /home/node/.npm/_logs/2019-12-23T11_15_00_888Z-debug.log
Package install failed, see above.
(node:612) UnhandledPromiseRejectionWarning: Error: Command failed: "/tmp/tmp-612Hhg0SJzHUREK/node_modules/.bin/ng" new workspace-yarn "--interactive=false" "--npm-scope=test" "--skipGit=true" "--skipInstall=false" "--style=scss" --preset="empty" --collection=@nrwl/workspace
    at checkExecSyncError (child_process.js:610:11)
    at Object.execSync (child_process.js:646:15)
    at createApp (/home/node/.config/yarn/global/node_modules/create-nx-workspace/bin/create-nx-workspace.js:356:21)
    at /home/node/.config/yarn/global/node_modules/create-nx-workspace/bin/create-nx-workspace.js:74:21
(node:612) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:612) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Done in 99.49s.

Context

> echo ${NG_CLI_ANALYTICS} 
1
> echo "uname=`uname -a`"
Linux nx--ops--dev--ng--latest-858b665f4-4fhqm 4.19.81 #1 SMP Tue Dec 10 16:09:50 PST 2019 x86_64 Linux
> echo "pwd=`pwd`"
/repo/workspaces/nx/workspace/tmp
> echo "whoami=`whoami`"
node
> node --version
v13.5.0
> npm --version
6.13.4
> yarn --version
1.21.1

Questions

May someone have any idea of why tao/minimist are failing like this or have any keys to share to workaround this issue :crossed_fingers: ?

hadrien-toma commented 4 years ago

I tried creating the workspace in the container file system instead of in the volume and it works, so the problem is likely to be on the volume side. :persevere:

hadrien-toma commented 4 years ago

For information: the problem I experience is related to https://github.com/kubernetes/minikube/issues/4621

github-actions[bot] commented 1 year ago

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.