-
Notifications
You must be signed in to change notification settings - Fork 521
Exception: Call to Node module failed with error: To use prerendering, you must install the 'aspnet-prerendering' NPM package. #144
Comments
A known issue in VS 2015 Update 2 (and all prior versions) is that it can't correctly restore NPM packages such as the Angular 2 ones due to path length limitations on Windows, and the fact that it uses NPM 2.x instead of NPM 3.x which solves the problem. If VS has been involved in trying to restore your NPM packages, then it's likely that your If you're using Angular 2 and VS, your options are:
The VS team is aware of the need to upgrade to NPM 3.x by default, and I believe has a fix coming not too long from now. Also, I just checked on a Windows machine that the latest |
If there files are definitely in the right place on disk, I'd have to guess that Node is looking for them in the wrong place. There are various ways of configuring where Node finds modules. Or, it might even be possible to launch your app in such a way that the current working directory is something other than the project root, and then the Node instance would look for I'd need to be able to repro this to investigate. So if you have a minimal project that causes the issue, and can post it online somewhere, please let me know. Or if you're able to debug and track down the fault, also please reopen the issue and post details so we can try to be more resilient against whatever condition your app is in. |
I am having this exact same issue. I am using the Angular Yeoman Template. All NPM Packages have installed correctly and when I use dot net run I get -
When I open up in VS2015 and run from there I get
Unfortunately I cannot load this to Github for you to view from work but I will try it out at home to see if it is an environmental issue tonight. If I get the same problem I will save the repro. |
OK so have tested this on my home PC and everything works as expected. (Win 10, Latest Node and NPM) So this issue is specific to my enviroment at work (Win 7 behind corporate firewall). Not sure where to start in resolving this. Any tips ? I have tried uninstalling/reinstalling Node, setting the node enviroment path and reinstalling all the various components without any luck. |
I had the same issue, but on windows 10. I was also using Nodist (Node version manager). I uninstalled Nodist. Deleted any Nodist and nodejs dirs under Program Files and Program Files (x86). I also deleted the npm-cache from AppData Roaming and made sure the NODE_PATH env var was deleted. Then I installed the latest version of node.js (node-v6.3.0-x64.msi). Installed global packages ... bower, yo, grunt-cli, gulp, webpack, etc... I then deleted the node_modules dir under my generated aspnet spa app and ran npm install. After all that it is working in prod and dev modes. Hope this info helps. |
I think I am edging towards a resolution. By editing the source code for SPAServices and adding __dirName to the prerendering error message I was able to establish that Node is running in the User\AppData\Local\Temp Directory when running this app. So I figured this was why node could not require the npm package. If I copy my Node Modules to that folder I get further, the prerender is found and instead get some errors with vendor.js and main.js. However I suspect that this is more due to my configuration issues than a problem with the code itself. Here is the error detail -
I have been looking around for ways to fix my Node configuration but am not having much luck. I have uninstalled and reinstalled several times, removed NODE_PATH etc. without any joy. I'm guessing there must be a setting somewhere that is causing node to behave strangely. I will keep you posted. |
I got that exact error message when I installed aspnet-prerendering and aspnet-webpack globally ... That was before I did all uninstall. Let me know if you determine the root issue with your environment. My solution didn't explain the root issue for me. BTW I am using the command line and visual studio code not Visual Studio. That is another difference. |
Ok So it is working now. I had one more stab at reinstalling Node. This time I -
Hope this helps someone. |
nicely done Joff :) |
i just removed webpack using Now everything is working fine ! |
One of my Win7 (64bit) PCs was also having this issue, but I was using The project successfully runs so that's good enough! Just putting this info out there incase anyone else runs into these issues. |
I have tried every single suggestion here and no matter what I do or how I try running this app, I get "Exception: Call to Node module failed with error: To use prerendering, you must install the 'aspnet-prerendering' NPM package." every single time. I have the absolute newest, cleanest install of node and npm. I have never used Visual Studio to run npm install or even run the app. I followed all the directions down to the single letter. aspnet-webpack is clearly installed and has all of its files. The only way I can get this to run is to kill off all attributes in in index.cshtml, which I'm pretty sure is going to kill off hot loading. I'm on Windows 10 if that matters. |
@SyntonicStudios Are you using node version manager or anything? Suspected that might of been my problem. I removed node completely and deleted all those folders, installed from scratch, semi works on one machine, fine on the other. Strange. |
Strange indeed. I'm running win 10 and using nvm and have had no issues with aspnet-prerending. @SyntonicStudios have you checked that aspnet-prerending exists in the node_modules folder? What project are you running up, one of the templates? |
I have never used the node version manager and I did indeed verify that the aspnet-prerendering was populated in the node_modules folder. I just tried this on my work machine and am getting a completely different error running from VS2015: At work running it from dotnet run seems to work, but the hot reloading doesn't seem to be working properly. It just gives me a flash of the updated content and then quickly reverts to the old stuff. Weird. I'm afraid this entire setup is just too brittle to be used for me. This is a shame because getting Angular 2 with TypeScript working properly in the same project as ASP.NET Core is bizarrely difficult right now. |
Have you tried globally installing webpack and also aspnet-webpack? Have you done an npm cache clean complete node_modules folder wipe, and reinstall / restore packages? @SyntonicStudios Brittle indeed, it'll get better soon! |
My project was working fine, and now I'm facing this issue. Can't remember any change I made that would've triggered this! I'm using node v6.3.1. |
@tinchou did you install nvm or anything and have multiple nodes running / anything like that? It is strange it keeps cropping up even after RTM was released. I need to look into what the real issue is that's causing this, but looks like everyone has different reasons. Try completely deleting node_modules and Restore Packages among other things. @SteveSandersonMS What can we log this issue to in terms of aspnet? Seems to be around post rc2 (even with Npm3+) |
It's working now. I had chakracore, node 6 and node 4. I followed all instructions here except for uninstalling the ones I wasn't using (it wasn't on the path, so it shouldn't affect, right?). That didn't work, so I uninstalled, cleaned again, rebooted, and it worked. |
And this just happened again when I switched from Node 5.X to Node 6.5.0 in Azure through the application settings configuration. I went into Kudu and cleaned the environment with these commands: cd D:\home\site\repository
git clean -xdf
cd ${env:APPDATA}
rm -r npm-cache
rm -r npm Then I deployed my app again without success. Any ideas how to better clean my App Service environment? |
I'm not sure what effect this "cleaning" process would have, but if you have access to a command-line interface on your server, can you check that the
... and perhaps more importantly:
This may return useful error information if there's some problem loading the |
And can you just confirm that it's definitely complaining about the absence of |
I'm using Azure App Service, and it's a managed service. I get an online console through Kudu at https://{{project}}.scm.azurewebsites.net/DebugConsole/?shell=powershell, but I don't have admin access. Anyway,
Thanks! |
I've published updated versions of Can you update to the latest versions of all of these and see if the extra info it gives will help you identify the cause? |
This is good and sucks at the same time: after upgrading these packages, it's working. So I can't give you debug information, but hopefully the next person will :). EDIT (I had disabled prerendering...): This is the exception message now:
The error is very clear to me now: it's trying to find the prerendering module in the current directory, but I don't deploy the I thought this would be bundled or automatically included, but seems like it's not (could it be?). I'll include node_modules for now, but doesn't seem like a good idea. I had removed it because of the huge time overhead it added to my deployment. I'll see if I can accomplish anything by bundling |
Hey I'm new to angular2 and facing the same problem, I finally have removed "asp-prerender-module " attribute from my tags to make my 3rd party tool primeNg work. |
Remove contents of folder "C:\Users<your user>\ node_modules/ " |
@sohaibjaved44 this is primarily related to primeng's use of "Event", which does not exist on the server. I use PrimeNG with this template for an internal tool - without any server-side rendering - and it the application is definitely not slow. The initial view is displayed within a few seconds. |
Tried a fresh install from the yeoman generator today, and even after running
npm i
(the node_modules folder isn't empty, everything is definitely installed) anddotnet restore
, when loading uplocalhost:5000
it shows an internal server error right away. Windows 7 PC. (I have no issues on a separate MAC)Also, strangely Visual Studio thinks that the dependencies weren't installed:
When running with F5 through Visual Studio it breaks here, and throws a similar error: Call to Node module failed with error: To use webpack dev middleware, you must install the 'aspnet-webpack' NPM package
The text was updated successfully, but these errors were encountered: