You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 8, 2020. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 8, 2020. It is now read-only.
IIS Deployment Error - Call to Node module failed with error: Error: no such file or directory at MemoryFileSystem.readFileSync #159
I can run the project (React & Redux template) fine using dotnet run but after running "dotnet publish -c Release" and then hosting the build in IIS I hit the below exception. Anyone had success with this? I've got the latest code, set the IIS AppPool to unmanaged code and given the app pool user full control over the entire directory.
Exception: Call to Node module failed with error: Error: no such file or directory
at MemoryFileSystem.readFileSync (C:\Development\Test Projects\CoreReactTest\bin\Release\netcoreapp1.0\publish\node_modules\memory-fs\lib\MemoryFileSystem.js:114:10)
at C:\Development\Test Projects\CoreReactTest\bin\Release\netcoreapp1.0\publish\node_modules\aspnet-webpack\LoadViaWebpack.js:70:65
at Compiler.<anonymous> (C:\Development\Test Projects\CoreReactTest\bin\Release\netcoreapp1.0\publish\node_modules\webpack\lib\Compiler.js:194:14)
at Compiler.emitRecords (C:\Development\Test Projects\CoreReactTest\bin\Release\netcoreapp1.0\publish\node_modules\webpack\lib\Compiler.js:282:37)
at Compiler.<anonymous> (C:\Development\Test Projects\CoreReactTest\bin\Release\netcoreapp1.0\publish\node_modules\webpack\lib\Compiler.js:187:11)
at C:\Development\Test Projects\CoreReactTest\bin\Release\netcoreapp1.0\publish\node_modules\webpack\lib\Compiler.js:275:11
at Compiler.applyPluginsAsync (C:\Development\Test Projects\CoreReactTest\bin\Release\netcoreapp1.0\publish\node_modules\tapable\lib\Tapable.js:60:69)
at Compiler.afterEmit (C:\Development\Test Projects\CoreReactTest\bin\Release\netcoreapp1.0\publish\node_modules\webpack\lib\Compiler.js:272:8)
at Compiler.<anonymous> (C:\Development\Test Projects\CoreReactTest\bin\Release\netcoreapp1.0\publish\node_modules\webpack\lib\Compiler.js:267:14)
at C:\Development\Test Projects\CoreReactTest\bin\Release\netcoreapp1.0\publish\node_modules\async\lib\async.js:52:16
Dug into this a little and it seems in the aspnet-webpack module in LoadViaWebpack.js in the following code the compiler.run() call doesn't return an err object but does raise pass an error via the stats variable and it results in webpack.output.js being missing.
compiler.run(function (err, stats) {
if (err) {
reject(err);
}
else {
// We're in a callback, so need an explicit try/catch to propagate any errors up the promise chain
try {
var fileContent = compiler.outputFileSystem.readFileSync('/webpack-output.js', 'utf8');
The error I'm seeing in the stats variable is below. So far I can't see why it thinks there is a syntax error there.
ERROR in ./ClientApp/boot-server.tsx
Module build failed: SyntaxError: C:/Development/Test Projects/CoreReactTest/bin/Release/netcoreapp1.0/publish/ClientApp/boot-server.tsx: Unexpected token (20:24)
18 | // Build an instance of the application
19 | const store = configureStore();
> 20 | const app = <Provider store={store}>
| ^
21 | </Provider>;
I've just published an update to the aspnet-webpack NPM package (new version: 1.0.5) which does a better job of catching Webpack compilation errors and reporting them, so if you update to that, you should see the actual syntax error message in the browser instead of the useless "no such file or directory" message.
As for why you actually have a syntax error, are you saying it works fine when you use dotnet run, but it's an error when you run inside IIS?
Yes works fine using dotnet run but I then ran publish to get a build to deploy to IIS and from within IIS I'm getting the issues. I'm using VS code but I did also try running from within VS2015 and it worked there as well.
I was originally trying to publish to Azure using a webhook to pull from a gitlab repo but was getting issues there so thought I'd simplify it and do a basic deploy to IIS to see what the problem is.
Thanks for the info. It turns out this was because .babelrc was not included in the publishOptions/include config in project.json. After adding this, publishing works fine.
You can fix your own site either by:
Manually copying .babelrc from your source root dir to your publish root dir
Or by modifying project.jsonlike this and republishing (remember to delete your old publish output first, or even better, publish to a separate directory not a child directly as is the default, because having a second copy of your app in a subdirectory will interfere with TypeScript module resolution)
Or by updating your copy of generator-aspnetcore-spa to the latest (0.2.1) and generating a new project.
Awesome, nice work! I checked the babel node modules and webpack config but overlooked the .babelrc. I'll fix it up manually in my build.
Yeah I saw the Typescript issues with using a sub dir but this was mainly just a quick test to find out the issue so I didn't bother changing the publish target folder. I'm using ES6 instead of typescript in my main project.
Activity
chris-herring commentedon Jul 1, 2016
Dug into this a little and it seems in the aspnet-webpack module in LoadViaWebpack.js in the following code the compiler.run() call doesn't return an err object but does raise pass an error via the stats variable and it results in webpack.output.js being missing.
The error I'm seeing in the stats variable is below. So far I can't see why it thinks there is a syntax error there.
SteveSandersonMS commentedon Jul 1, 2016
Thanks for reporting this!
I've just published an update to the
aspnet-webpackNPM package (new version: 1.0.5) which does a better job of catching Webpack compilation errors and reporting them, so if you update to that, you should see the actual syntax error message in the browser instead of the useless "no such file or directory" message.As for why you actually have a syntax error, are you saying it works fine when you use
dotnet run, but it's an error when you run inside IIS?chris-herring commentedon Jul 1, 2016
Thanks for the update.
Yes works fine using dotnet run but I then ran publish to get a build to deploy to IIS and from within IIS I'm getting the issues. I'm using VS code but I did also try running from within VS2015 and it worked there as well.
I was originally trying to publish to Azure using a webhook to pull from a gitlab repo but was getting issues there so thought I'd simplify it and do a basic deploy to IIS to see what the problem is.
SteveSandersonMS commentedon Jul 1, 2016
Thanks for the info. It turns out this was because
.babelrcwas not included in thepublishOptions/includeconfig inproject.json. After adding this, publishing works fine.You can fix your own site either by:
.babelrcfrom your source root dir to your publish root dirproject.jsonlike this and republishing (remember to delete your old publish output first, or even better, publish to a separate directory not a child directly as is the default, because having a second copy of your app in a subdirectory will interfere with TypeScript module resolution)generator-aspnetcore-spato the latest (0.2.1) and generating a new project.chris-herring commentedon Jul 2, 2016
Awesome, nice work! I checked the babel node modules and webpack config but overlooked the
.babelrc. I'll fix it up manually in my build.Yeah I saw the Typescript issues with using a sub dir but this was mainly just a quick test to find out the issue so I didn't bother changing the publish target folder. I'm using ES6 instead of typescript in my main project.
yehia2amer commentedon Jul 20, 2016
@SteveSandersonMS WooOoow, i just used
npm install -g aspnet-webpackand Now everything is working fine !
Thanks