Closed livarcocc closed 6 years ago
Thank you, @livarcocc for migrating the issue 🙏 And I am sorry to cause you a trouble 😥 for opening an issue on a wrong project.
Thanks for reporting this, we'll take a look
TL;DR - the particular node modules that have been added to the project contain a template.json
file
In newer CLIs, the crash issue has been fixed & some diagnostics have been added (you can get a better feel for what's going wrong by specifying the --trace:authoring
flag when installing the package). Unfortunately, it doesn't make this particular case much clearer, we end up inferring enough of the settings to make it through the basic validation that if the template could be installed it could run (though it probably wouldn't do anything of interest). Things fall down though when it finally tries to register it - the "identity" property is missing from the file, causing it to null reference out when adding it to the in-memory cache before writing it to disk.
There's another item (#1492) that also touches on this topic. I'm preparing a PR now to:
Thank you @mlorbetske.
And I will also try --trace:authoring
with the new CLI should I come up with an issue next time.
Thank you @mlorbetske .
Would the next release of dotnet
CLI reflect the update?
The CLI after 2.1.300-preview2 should contain the update (2.1.3xx)
Get Outlook for iOShttps://aka.ms/o0ukef
From: Sung Kim notifications@github.com Sent: Tuesday, April 10, 2018 7:39:06 PM To: dotnet/templating Cc: Mike Lorbetske; Mention Subject: Re: [dotnet/templating] "dotnet new" fails to install a new template with "node_modules" with "Error: Value cannot be null" message (#1498)
Thank you @mlorbetskehttps://github.com/mlorbetske . Would the next release of dotnet CLI reflect the update?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/dotnet/templating/issues/1498#issuecomment-380308102, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ABWXUeamL6BMbNOHtvBjs1BWAkadlaQyks5tnWzKgaJpZM4TGDa4.
Bumping into this issue with CLI 2.1.500-preview-009335 and installing a template with a node_modules directory. I'm also trying to exclude the node_modules directory in the exclude property of the template.json. Doesn't help ☹.
Is this already in the CLI version I'm using?
C:\Projects> dotnet -h
.NET Command Line Tools (2.1.500-preview-009335)
Usage: dotnet [runtime-options] [path-to-application] [arguments]
Encountering this issue with version 2.1.502. Any suggestions?
> dotnet -h
.NET Command Line Tools (2.1.502)
@DeluxZ excluding it in template.json won't help as the directory will be present in the nupkg. If this is the same issue where a template.json exists in the nupkg but isn't a valid template, the only solution would be to remove it from the nupkg (possibly by excluding it from the project file used to create the package).
@dominikmontada could you elaborate on what you're seeing?
@mlorbetske Sure thing. I set up a minimal example with vue-cli version 2 here, but you can also create this youself by running vue init webpack
and then creating the template config yourself.
After cloning, run npm install
, followed by dotnet new -i .
from inside the directory. It will fail with
Error: Could not install ".".
Error: Value cannot be null.
Parameter name: key
Deleting the node_modules folder remedies the problem.
I included a global.json with the SDK version set to 2.1.502. With the newest version, 2.2.101, I am unable to reproduce the problem.
From @dance2die on April 4, 2018 1:36
Steps to reproduce
dotnet new
SPA project,react
.Processing post-creation actions... ... Manual instructions: Run "npm install"
.template.config
and a new configuration file,template.json
.template.json
file.ThisFails
.Expected behavior
Go to the
ThisFails
folder and deletenode_modules
folder.Go up one directory
Installing works without an error.
Actual behavior
Fails with following error message.
Environment data
Copied from original issue: dotnet/cli#8989