aws-cdk icon indicating copy to clipboard operation
aws-cdk copied to clipboard

Unable to cope with space in windows username

Open rtkelly13 opened this issue 7 years ago • 11 comments

Describe the bug My username on my PC is "Ryan Kelly" when I attempt to run cdk synth I get the following error

Unhandled Exception: Amazon.JSII.Runtime.JsiiException: Child process exited unexpectedly: internal/modules/cjs/loader.js:584
    throw err;
    ^

Error: Cannot find module 'C:\Users\Ryan'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
    at Function.Module._load (internal/modules/cjs/loader.js:508:25)

C:\source\hg\sentric-rights-serverless\infra\cdk>cdk synth

Unhandled Exception: Amazon.JSII.Runtime.JsiiException: Child process exited unexpectedly: internal/modules/cjs/loader.js:584
    throw err;
    ^

Error: Cannot find module 'C:\Users\Ryan'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
    at Function.Module._load (internal/modules/cjs/loader.js:508:25)
    at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

   at Amazon.JSII.Runtime.Services.Runtime.ReadResponse()
   at Amazon.JSII.Runtime.Services.Client.ReceiveResponse[TResponse]()
   at Amazon.JSII.Runtime.Services.ServiceContainer.BuildServiceProvider(ILoggerFactory loggerFactoryOverride)
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at Amazon.JSII.Runtime.Deputy.JsiiTypeAttributeBase.Load(Assembly assembly)
   at Amazon.JSII.Runtime.Deputy.JsiiTypeAttributeBase.Load(Assembly assembly)
   at Amazon.JSII.Runtime.Deputy.JsiiClassAttribute..ctor(Type nativeType, String fullyQualifiedName, String parametersJson)
   at System.Reflection.CustomAttribute._CreateCaObject(RuntimeModule pModule, IRuntimeMethodInfo pCtor, Byte** ppBlob, Byte* pEndBlob, Int32* pcNamedArgs)
   at System.Reflection.CustomAttribute.CreateCaObject(RuntimeModule module, IRuntimeMethodInfo ctor, IntPtr& blob, IntPtr blobEnd, Int32& namedArgs)
   at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes)
   at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeType type, RuntimeType caType, Boolean inherit)
   at System.Attribute.GetCustomAttributes(MemberInfo element, Type type, Boolean inherit)
   at System.Attribute.GetCustomAttribute(MemberInfo element, Type attributeType, Boolean inherit)
   at System.Reflection.CustomAttributeExtensions.GetCustomAttribute[T](MemberInfo element)
   at Amazon.JSII.Runtime.ReflectionUtils.GetClassAttribute(Type type)
   at Amazon.JSII.Runtime.Deputy.DeputyBase..ctor(DeputyProps props)
   at HelloCdk.Program.Main(String[] args) in C:\source\hg\sentric-rights-serverless\infra\cdk\src\HelloCdk\Program.cs:line 12
Subprocess exited with error 3762504530

To Reproduce cdk init --language csharp dotnet build src cdk synth

Expected behavior Be able to run cdk synth to generate the CloudFormation template

Version:

  • OS Windows 10
  • Programming Language C#
  • CDK Version 0.31.0 (build 7a70c08)

rtkelly13 avatar May 13 '19 08:05 rtkelly13

What version of node are you using?

RomainMuller avatar Jun 20 '19 15:06 RomainMuller

I am experiencing this problem as well. Using:

  • CDK: 1.3.0 (build bba9914)
  • Node: v10.16.1
  • npm (not sure if its relevant, but here goes): 6.9.0

Would be reeeally nice if there is some simple workaround to this issue :)

M-Gram avatar Aug 05 '19 12:08 M-Gram

Any progress on what the issue is? Problem still persists even with Node v12.13.1 CDK 1.18

Under other circumstances i would just change my username, but company policy is not so easily changed unfortunately...

Mikkel-Gram avatar Dec 16 '19 10:12 Mikkel-Gram

+1

thylux avatar Jan 17 '20 10:01 thylux

Can you change your node install base directory or map a drive letter to your home directory?

https://support.microsoft.com/en-us/help/4026635/windows-map-a-network-drive

swe-ds avatar Jan 17 '20 11:01 swe-ds

This works for windows. You can use the short path name in the environment variable, e.g. use "C:\PROGRA~1\nodejs" instead of "C:\Progam Files\nodejs".

You can find out the correct short name of your folder by executing dir /x in the parent folder.

swe-ds avatar Jan 17 '20 12:01 swe-ds

Still not working: image

thylux avatar Jan 17 '20 14:01 thylux

Thanks for the reply @Douglas-Scott , im just not sure where to put this short path in. There is an entry under that path variable for nodejs, but the error appears referencing some path under the C:/Users/username path instead (like you see in the image posted by @thylux .

did you try this solution to make the cdk work? And if so did you change the path in different places than just the env vars?

Mikkel-Gram avatar Feb 07 '20 09:02 Mikkel-Gram

I was able to workaround it by temporary setting TEMP and TMP environment variables to "C:\temp", so it is not going into my profile folder.

olmelabs avatar Sep 03 '20 14:09 olmelabs

I was able to workaround it by temporary setting TEMP and TMP environment variables to "C:\temp", so it is not going into my profile folder.

This workaround works for me.

pacdaemon avatar Sep 25 '20 02:09 pacdaemon

This issue has not received any attention in 1 year. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

github-actions[bot] avatar Jun 18 '22 20:06 github-actions[bot]