In package.json I have:
{
"name": "projName",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"prestart": "node aspnetcore-https",
...
when I run npm start I get:
Error: Cannot find module ‘…aspnetcore-https’
How can I install the module?
If I try
npm install aspnetcore-https
I get:
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/aspnetcore-https - Not found
I have this line I think because I copied the packages.json from a Visual Studio Angular Typescript project into a Typescript only source code folder, but the latter folder project should still work if I install the correct package?
Update: the project runs correctly from npm start if I just remove the line
"prestart": "node aspnetcore-https",
but I’d like to understand why I can’t install this module?
2
Answers
If you took this package file from a Visual Studio app, it probably means that they used a custom project generator (not @angular/cli) and they added a custom file called
aspnetcore-https.js
.If you move the package file away from its original folder, it becomes unable to find this file.
This is your issue.
Visual studio installs a aspnetcore-https.js file into the ClientApp folder. This file is typically excluded from source control. The file is missing from your project folder.
Below is the contents of my copy: