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.
Webpackmiddleware - SyntaxError: Use of const in strict mode #855
dotnet new --install Microsoft.AspNetCore.SpaTemplates::*
dotnet new angular
`
Open VS 2017 and the project that was created.
Run the application via F5 and the following exception gets generated against startup.cs on the webpack middleware
Exception: Call to Node module failed with error: Webpack dev middleware failed because of an error while loading 'aspnet-webpack'.
Error was: C:\Users\jamie\Documents\SourceCode\spike-angular-on-core\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. (C:\Users\jamie\Documents\SourceCode\spike-angular-on-core\node_modules\aspnet-webpack\WebpackDevMiddleware.js:4:15)
From what I can understand of the problem node_modules\webpack\lib\webpack.js is using ES6 definitions while the Typescript behind node_modules\aspnet-webpack\WebpackDevMiddleware.js is using ES2015. How does a developer resolve this?
@SteveSanderson thanks, looks like the windows path variable was not correctly updated in the node 6 or 7 x64 installation. Nodejs discussion.
After updating the path to the correct location node -v v6.10.2
The solution then works as expected. Thanks.
Activity
SteveSandersonMS commentedon Apr 11, 2017
Your version of Node is too old - please update to a newer version that supports
constby default.Jamie-Clayton commentedon Apr 11, 2017
@SteveSanderson thanks, looks like the windows path variable was not correctly updated in the node 6 or 7 x64 installation. Nodejs discussion.
After updating the path to the correct location
node -v v6.10.2The solution then works as expected. Thanks.