I'm creating a new project with this tutorial:
Next some resolved issues, I have now a complete project with all dependencies installed but when I launch the project with IIS, I have this error .
L'exception System.AggregateException s'est produite
HResult=0x80131500
Message=One or more errors occurred.
Source=<Impossible d'évaluer la source de l'exception>
Arborescence des appels de procédure :
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at Microsoft.AspNetCore.Builder.WebpackDevMiddleware.UseWebpackDevMiddleware(IApplicationBuilder appBuilder, WebpackDevMiddlewareOptions options)
at Test.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) in C:\VS2017\Project\Test\Startup.cs:line 44
Exception interne 1 :
Exception : Call to Node module failed with error: Webpack dev middleware failed because of an error while loading 'aspnet-webpack'. Error was: C:\VS2017\Project\Test\node_modules\webpack\lib\webpack.js:7
const Compiler = require("./Compiler");
^^^^^
SyntaxError: Use of const in strict mode.
at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (C:\VS2017\Project\Test\node_modules\aspnet-webpack\WebpackDevMiddleware.js:4:15)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
Current directory is: C:\VS2017\Project\Test
I don't know which step I failed so if someone already did it.
This happens because the aspnet-webpack
node package requires a newer version of node
.
The const and let are part of ECMAScript 2015 (a.k.a. ES6 and Harmony), and was not enabled by default in Node.js 0.10 or 0.12. Since Node.js 4.x, “All shipping [ES2015] features, which V8 considers stable, are turned on by default on Node.js and do NOT require any kind of runtime flag.”.
So by upgrading to Node.js 4.x or newer the error should disappear.
https://stackoverflow.com/a/23151062/5082427
Update
You can check the installed version of node by executing node -v
in the command-line. If this command outputs an older version than the one you have installed, check the PATH
environment variable to ensure you don't have multiple node installations.