Today I was trying to work on Angular2 (template https://akveo.github.io). As per installation guide, I ran following commands.
I have installed Node.js v6.9.1
.
npm install
--Worked fine.npm server
--Failed with below error.
E:\........\node_modules\script-ext-html-webpack-plugin\index.js:3
const INLINE = 'inline';
^^^^^
SyntaxError: Use of const in strict mode.
at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
After many random searches and failing to resolve it, I decided to think about it with a calm head. To me it looks like it is a problem with ES2015/ES6
. Package script-ext-html-webpack-plugin
uses const
variable which is a ES2016
feature. However system is unable to resolve it.
Also this problem can come with any package like hapi
, selinium
etc. But everything should have same solution I guess.
I have tried many related commands on the installation guide of the website mentioned above but nothing works and ends with same error. I have also many have faced same issue online but nothing concrete is visible as answer. Could anyone help me out?
Update
Below approach has also fixed many of my colleague's machine who were facing some random errors with nodejs.
This problem is resolved in at least my machine. I am certainly not a person who understand nodejs
completely but got it working after some googling. The solution given below may be common to many other issues I guess.
The system I am working has Windows 10 as Operating System and has 64 bit processor.
nodejs
(just to make sure you do not have traces of any previous install).nodejs
from their website (I installed v6.9.1
for 64 bit processor).Path
. Delete ‘C:/Program Files (x86)/nodejs’ (as I had installed 64 bit nodejs). This ensures when using command you do not use any other previously installed nodejs
. npm install
.npm info graceful-fs -v
or npm info graceful-fs
whichever runs in your machine.npm update -g npm
.npm install
again and this time it should work.npm start
and everything should work fine.SASS
configuration due to 32/64 bit machine and console log asked me to run npm rebuild node-sass
to fix the issue.Ctrl+C
to stop npm server. Run node rebuild node-sass
. Run npm start
again and everything should be working.Hope it helps.