dotnet new install issue - Error: Value cannot be null
.NET CLI has made it easy to create a new template. Sometimes you might get a following error message while creating a SPA template.
|> dotnet new -i .\NewTemplate|
|Error: Could not install ".\NewTemplate".|
|Error: Value cannot be null.|
|Parameter name: key|
I will show you what has caused it and how to get around it.
🤔 The Cause
According to Mike Lorbetske, the error occurs when one of the
node_modules folders contain a
TL;DR - the particular node modules that have been added to the project contain a
So if you have a
node_modules folder in your template, delete it then you are good to go.
NOTE 📝: The next version of .NET CLI templating engine (dotnet new3) has
--trace:authoring option but wouldn't be helpful in this case according to Mike.
🚪 Closing Remark
I've reported the issue on GitHub and Mike is preparing a PR to address this issue. The issue page has the comprehensive steps to reproduce the error and how to resolve it.
This issue was found while creating a new SPA template for ASP.NET Core with React.js with ES6 because the default template uses TypeScript.
You can find more about how to use it on dev.to site 😉.