-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot find module 'aspnet-webpack' #5169
Comments
The app loads if the Service Fabric app package includes node.exe, node_modules, Client_App and webpack.config.js. But it seems that Webpack dev middleware does not pick up / reload the file changes. |
It sounds like you're trying to run your app in Service Fabric without first publishing it. As in, you're deploying the files that come directly out of the template, instead of deploying the output from When running in production, make sure your ASP.NET app is set to "production" environment. Then it won't attempt to run Webpack dev middleware (which you shouldn't enable in production - it's only a dev-time feature). |
Thanks for the reply. I think you should try the scenario and reconsider your choice. The exception above is thrown when running on dev-machine. To reproduce:
You should either (a) fix the issue, (b) remove the HotModuleReplacement option for Angular template in Service Fabric apps, or (c) remove the Angular template option for Service Fabric apps. Our workaround is to set the web project as the StartUp project to get the HMR to work. |
Ah, I see, thanks for clarifying. I thought you were talking about a production app, not in development. Reopening for investigation. |
Running into a similar issue. Do apps running in Service Fabric even support WebpackDevMiddleware and HotModuleReplacement? |
I'm running into the same issue. Is there a known workaround? I'm running 6.0.211/2.8.211 |
To move forward for now we commented out this in Startup.Configure:
|
I've just bumped into this issue when deploying to a new AWS server. I published the app to my local file system then copied it over to the AWS server - and got a generic .net Core error message saying something along the lines of 'Computer says no. Set ASPNETCORE_ENVIRONMENT to Development for more information...' So I duly set that environment variable - found out that Node.js wasn't installed; installed that - then bumped into this error. After a bit of head-scratching, it became pretty obvious that the reason I was getting this error is because I set ASPNETCORE_ENVIRONMENT to Development so I could find out more information about errors! I followed WillTartak's advice above and it all worked fine - it also all worked fine when I deleted the ASPNETCORE_ENVIRONMENT environment variable. So, fundamentally, if you're running on something that doesn't support HotModuleReplacement, then either make sure that ASPNETCORE_ENVIRONMENT isn't set to Development or only allow HotModuleReplacement in DEBUG, e.g.
|
I've got to the same issue, however it may have caused by different reason. |
For the reference, here's my error message:
Note, current directory was correctly set to the application's directory. So |
That would be convenient, but unfortunately that's not quite how Node works in general: aspnet/JavaScriptServices#154 |
Thank you @SteveSandersonMS that clarified a lot. Setting |
Thanks JasonBro, work for me. |
I ran 'npm install' in the root of project directory and it fixed everything for me. |
I had a similar issue for the web API project with the React template, so writing it down in case someone else needs it. I ended up doing this:
This is because in certain conditions the base path is not set to the project root but to the output folder. For the latter, it means the node package is not available, since it is installed in the project root and not in the output folder. |
In Service Fabric I've found that I don't encounter this error when using Refresh Mode on a local single node cluster. However the webpack builds only seem to occur if |
Upon further investigation I think something is happening with the NodeService itself. WebpackDevMiddleware doesn't see any |
Closing this issue as there was no community involvement for quite a while now. |
Exception thrown when starting the app created by using Service Fabric Asp.Net Core 2.0 Angular template. Running on Service Fabric 5.7.198.
"Webpack dev middleware failed because of an error while loading 'aspnet-webpack'. Error was: Error: Cannot find module 'aspnet-webpack'\n at Function.Module._resolveFilename (module.js:485:15)\n at Function.Module._load (module.js:437:25)\n at Module.require (module.js:513:17)\n at require (internal/module.js:11:18)\n at Object. (C:\SfDevCluster\Data\_App\_Node_2\Application4Type_App59\temp\nlcuhlos.kzt:83:19)\n at webpack_require (C:\SfDevCluster\Data\_App\_Node_2\Application4Type_App59\temp\nlcuhlos.kzt:20:30)\n at createWebpackDevServer (C:\SfDevCluster\Data\_App\_Node_2\Application4Type_App59\temp\nlcuhlos.kzt:62:26)\n at C:\SfDevCluster\Data\_App\_Node_2\Application4Type_App59\temp\vyr4pqpo.yvi:114:19\n at IncomingMessage. (C:\SfDevCluster\Data\_App\_Node_2\Application4Type_App59\temp\vyr4pqpo.yvi:133:38)\n at emitNone (events.js:105:13)\nCurrent directory is: C:\SfDevCluster\Data\_App\_Node_2\Application4Type_App59\Web1Pkg.Code.1.0.0\r\n"
The text was updated successfully, but these errors were encountered: