> dotnet new -i .\NewTemplate Error: Could not install ".\NewTemplate". Error: Value cannot be null. Parameter name: key
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 template.json file
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.
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.
**** UPDATE 2018/04/10 ****
The fix will be available in "The CLI after 2.1.300-preview2".
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 in my previous article, ASP.NET Core 2 React.js Template with ES6 (not TypeScript) .😉.