Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Error: EACCES: permission denied, lstat..." when deploying from git bash in Windows #22

Open
danbrakeley opened this issue Sep 18, 2021 · 4 comments

Comments

@danbrakeley
Copy link

I'm on Windows 10 Pro, with Docker for Windows running, and using git bash as my shell, and I was going through the steps in the README to deploy to a newly created sub-account (where cdk had already successfully bootstrapped), and got this output:

$ npx cdk --profile dbgames deploy --all
MFA token for arn:aws:iam::**********:mfa/******: ******
#1 [internal] load build definition from Dockerfile
#1 sha256:771197e9852863b46b3015849ef3bb4191be2a9598b28631de09f92b407b0aae
#1 transferring dockerfile: 32B done
#1 DONE 0.0s

#2 [internal] load .dockerignore
#2 sha256:00052d643de5318aa5bb4f51e8f2201818735e97b10a673293f57c134a40c83c
#2 transferring context: 2B done
#2 DONE 0.1s

#3 [internal] load metadata for docker.io/amazon/aws-sam-cli-build-image-nodejs10.x:latest
#3 sha256:22b94e7432981cb8a0273982fb3d66047200fe5f906a4417fb0e377004adb91e
#3 ...

#4 [auth] amazon/aws-sam-cli-build-image-nodejs10.x:pull token for registry-1.docker.io
#4 sha256:3bfcb5c23d336051e072380562237c3f22665825c675b0b859b8b0e08ddce5ef
#4 DONE 0.0s

#3 [internal] load metadata for docker.io/amazon/aws-sam-cli-build-image-nodejs10.x:latest
#3 sha256:22b94e7432981cb8a0273982fb3d66047200fe5f906a4417fb0e377004adb91e
#3 DONE 0.8s

#5 [1/7] FROM docker.io/amazon/aws-sam-cli-build-image-nodejs10.x@sha256:e57fba80c9947cb56fce236f735fc65a12c34c400ee47d2296d4216c35a4429b
#5 sha256:2aa847f18adf0c41aa02703c2376edbdc3bf3c2fdb6326741e7889ab15fa7855
#5 DONE 0.0s

#6 [2/7] RUN npm install --global yarn@1.22.5
#6 sha256:ede7833aa5ed3ed4b41fce2d978f9ec70dc20aec7b72851cad683a8de785f0ea
#6 CACHED

#9 [5/7] RUN mkdir /tmp/yarn-cache &&     chmod -R 777 /tmp/yarn-cache &&     yarn config set cache-folder /tmp/yarn-cache
#9 sha256:e349bf4b05ac7b0ab5b2713cfdd87bbaa1bd29aecc938f88bff13527b86efc2d
#9 CACHED

#8 [4/7] RUN mkdir /tmp/npm-cache &&     chmod -R 777 /tmp/npm-cache &&     npm config --global set cache /tmp/npm-cache
#8 sha256:0e02bc797552de67f9baba5a1c08178fa8b23b7d3a635d22b2319e57070c5797
#8 CACHED

#10 [6/7] RUN npm config --global set update-notifier false
#10 sha256:ced028c5d4ad17bdcdf3ad167267c5a79e823e8fbf330bc3a53016eb28f06b2a
#10 CACHED

#7 [3/7] RUN npm install --global --unsafe-perm=true esbuild@0
#7 sha256:23485a70c1684d55c64f90ff3460dcff3c4ff00293e4b9941a22926f888bf185
#7 CACHED

#11 [7/7] RUN /sbin/useradd -u 1000 user && chmod 711 /
#11 sha256:582fdda1f0e33b54899f1bdac55a7a7212cd0375b446a1aedd561dc04e5342af
#11 CACHED

#12 exporting to image
#12 sha256:e8c613e07b0b7ff33893b694f7759a10d42e180f2b4dc349fb57dc6b71dcab00
#12 exporting layers done
#12 writing image sha256:0380b4014721dd01201a913cf90d288fa57ac1500d204155e231616fb5a9dc5c done
#12 naming to docker.io/library/cdk-f4fe827154c06ccd25db709d24f041465d2a39fa3905b67ac145c7ee4fce87c7
#12 naming to docker.io/library/cdk-f4fe827154c06ccd25db709d24f041465d2a39fa3905b67ac145c7ee4fce87c7 done
#12 DONE 0.1s

Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
Bundling asset LambdaEcsFargateUpdownstatusStack/Status/serverStatus/Code/Stage...
esbuild cannot run locally. Switching to Docker bundling.

  asset-output/index.js  2.4kb

⚡ Done in 14ms

> fast-xml-parser@3.17.4 postinstall /asset-output/node_modules/fast-xml-parser
> node tasks/postinstall.js || exit 0

Love fast-xml-parser? Check https://amitkumargupta.work for more projects and contribution.

npm WARN asset-output No description
npm WARN asset-output No repository field.
npm WARN asset-output No license field.

added 115 packages from 18 contributors and audited 115 packages in 19.133s

1 package is looking for funding
  run `npm fund` for details

found 0 vulnerabilities

Error: EACCES: permission denied, lstat 'D:\dev\valheim-ecs-fargate-cdk\cdk.out\bundling-temp-b32470dec8d31066aa9a5bfbe41ec61a57ab003f69ae2eda0d92c8b99543c39d\node_modules\.bin\xml2js'
    at Object.lstatSync (fs.js:1115:3)
    at _processFileOrDirectory (D:\dev\valheim-ecs-fargate-cdk\node_modules\@aws-cdk\core\lib\fs\fingerprint.ts:56:21)
    at _processFileOrDirectory (D:\dev\valheim-ecs-fargate-cdk\node_modules\@aws-cdk\core\lib\fs\fingerprint.ts:70:9)
    at _processFileOrDirectory (D:\dev\valheim-ecs-fargate-cdk\node_modules\@aws-cdk\core\lib\fs\fingerprint.ts:70:9)
    at _processFileOrDirectory (D:\dev\valheim-ecs-fargate-cdk\node_modules\@aws-cdk\core\lib\fs\fingerprint.ts:70:9)
    at Object.fingerprint (D:\dev\valheim-ecs-fargate-cdk\node_modules\@aws-cdk\core\lib\fs\fingerprint.ts:45:3)
    at Function.fingerprint (D:\dev\valheim-ecs-fargate-cdk\node_modules\@aws-cdk\core\lib\fs\index.ts:38:12)
    at AssetStaging.calculateHash (D:\dev\valheim-ecs-fargate-cdk\node_modules\@aws-cdk\core\lib\asset-staging.ts:507:27)
    at AssetStaging.stageByBundling (D:\dev\valheim-ecs-fargate-cdk\node_modules\@aws-cdk\core\lib\asset-staging.ts:337:35)
    at stageThisAsset (D:\dev\valheim-ecs-fargate-cdk\node_modules\@aws-cdk\core\lib\asset-staging.ts:196:35)
Subprocess exited with error 1
@danbrakeley
Copy link
Author

I just now tried doing the same thing in Ubuntu via WSL, and it seems to have worked! But ideally I wouldn't need to do this via WSL.

@AndyBarnett
Copy link

I battled this for hours and ended up just having to switch to mac to get it to work

@malkhuzayyim
Copy link

I just now tried doing the same thing in Ubuntu via WSL, and it seems to have worked! But ideally I wouldn't need to do this via WSL.

I've been struggling with this for hours now.

The error I'm hitting is quite identical to what you ran into here.

Do you have any tips on how to correctly setup WSL for this?

@danbrakeley
Copy link
Author

So if you are asking how to install WSL, I haven't had to do it in a while, but Microsoft should have official instructions. Also, I don't know if you still have to manually opt into WSL2, but there are big differences between WSL1 and WSL2, and WSL2 actually runs a real linux kernel in a hyper-v VM, vs WSL1 which is just a translation layer, and not a full kernel. So if you tried WSL1, I'd try WSL2 instead.

Some quick searches yields this promising page (including calling out how to check and set the WSL version): https://learn.microsoft.com/en-us/windows/wsl/basic-commands

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants