Unable to cope with space in windows username
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)
What version of node are you using?
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 :)
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...
+1
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
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.
Still not working:

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?
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.
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.
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.