question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cdk init requires git global configuration

See original GitHub issue

On my machine I don’t have a global git config for username and email because for every repository I create I want to explicitly set whether I’m using my work or personal account. Since I don’t have that I get errors when I execute cdk init app --language=typescript

> cdk init app --language=typescript                                                                                                                        
Error: ENOENT: no such file or directory, open 'c:\Users\norm\.aws\config'                                                                                  
    at Object.fs.openSync (fs.js:646:18)                                                                                                                    
    at Object.fs.readFileSync (fs.js:551:33)                                                                                                                
    at Object.readFileSync (C:\Users\Norm\AppData\Roaming\npm\node_modules\aws-cdk\node_modules\aws-sdk\lib\util.js:97:26)                                  
    at SharedIniFile.loadFile [as ensureFileLoaded] (C:\Users\Norm\AppData\Roaming\npm\node_modules\aws-cdk\node_modules\aws-sdk\lib\shared_ini.js:19:18)   
    at SharedIniFile.loadProfile [as getProfile] (C:\Users\Norm\AppData\Roaming\npm\node_modules\aws-cdk\node_modules\aws-sdk\lib\shared_ini.js:52:10)      
    at Config.region (C:\Users\Norm\AppData\Roaming\npm\node_modules\aws-cdk\node_modules\aws-sdk\lib\node_loader.js:88:34)                                 
    at Config.set (C:\Users\Norm\AppData\Roaming\npm\node_modules\aws-cdk\node_modules\aws-sdk\lib\config.js:448:39)                                        
    at Config.<anonymous> (C:\Users\Norm\AppData\Roaming\npm\node_modules\aws-cdk\node_modules\aws-sdk\lib\config.js:283:12)                                
    at Config.each (C:\Users\Norm\AppData\Roaming\npm\node_modules\aws-cdk\node_modules\aws-sdk\lib\util.js:485:32)                                         
    at new Config (C:\Users\Norm\AppData\Roaming\npm\node_modules\aws-cdk\node_modules\aws-sdk\lib\config.js:282:19)                                        
default@us-west-2 C:\temp\cdk-test\hello-cdk                                                                                                                
> cdk init app --language=typescript                                                                                                                        
Initializing a new git repository...                                                                                                                        
Applying project template app for typescript                                                                                                                
Executing npm install...                                                                                                                                    
npm notice created a lockfile as package-lock.json. You should commit this file.                                                                            
npm WARN hello-cdk@0.1.0 No repository field.                                                                                                               
npm WARN hello-cdk@0.1.0 No license field.                                                                                                                  
                                                                                                                                                            
warning: LF will be replaced by CRLF in .gitignore.                                                                                                         
The file will have its original line endings in your working directory.                                                                                     
warning: LF will be replaced by CRLF in .npmignore.                                                                                                         
The file will have its original line endings in your working directory.                                                                                     
warning: LF will be replaced by CRLF in README.md.                                                                                                          
The file will have its original line endings in your working directory.                                                                                     
warning: LF will be replaced by CRLF in bin/hello-cdk.ts.                                                                                                   
The file will have its original line endings in your working directory.                                                                                     
warning: LF will be replaced by CRLF in cdk.json.                                                                                                           
The file will have its original line endings in your working directory.                                                                                     
warning: LF will be replaced by CRLF in package-lock.json.                                                                                                  
The file will have its original line endings in your working directory.                                                                                     
warning: LF will be replaced by CRLF in package.json.                                                                                                       
The file will have its original line endings in your working directory.                                                                                     
warning: LF will be replaced by CRLF in tsconfig.json.                                                                                                      
The file will have its original line endings in your working directory.                                                                                     
                                                                                                                                                            
*** Please tell me who you are.                                                                                                                             
                                                                                                                                                            
Run                                                                                                                                                         
                                                                                                                                                            
  git config --global user.email "you@example.com"                                                                                                          
  git config --global user.name "Your Name"                                                                                                                 
                                                                                                                                                            
to set your account's default identity.                                                                                                                     
Omit --global to set the identity only in this repository.                                                                                                  
                                                                                                                                                            
fatal: unable to auto-detect email address (got 'Norm@master-control.(none)')                                                                               
git exited with status 128              

Looks like the project isn’t finished creating either because when I run cdk synth I get errors about a missing hello-cdk.js.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
rix0rrrcommented, Aug 16, 2018

I think we might also just be able to survive a failing git command and notify the user.

1reaction
rix0rrrcommented, Aug 9, 2018

The setup probably finished, but what didn’t happen is that the project got compiled for you.

You need to run:

npm run build

first to compile the .ts to .js.

Read more comments on GitHub >

github_iconTop Results From Across the Web

AWS CDK Toolkit (cdk command) - AWS Documentation
The AWS CDK Toolkit, the CLI command cdk , is the primary tool for interacting with your AWS CDK app. It executes your...
Read more >
4 Methods to configure multiple environments in the AWS CDK
In this post I will explore 4 different methods that can be used to pass configuration values to the AWS CDK. We will...
Read more >
Setup AWS CDK In 2 Minutes
This article will guide you to install and configure AWS CDK for all your ... This will install the latest stable version of...
Read more >
How to install AWS CDK (step-by-step guide)
To install AWS CDK, run the following command in your terminal: npm install -g aws-cdk . This will install the AWS CDK package...
Read more >
CDK tips, part 1 – how to use local CDK commands
CDK init and NPX ; npx cdk command for invoking the local version of the CLI; if ; npx finds the package it...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found