0

My node version is v9.3.0 and the npm version is 5.5.1. I am trying to create and run a sample project using:

ng new test;
ng serve -o;

The the angular cli compiles the program successfully but my browser page is blank and the console log results in:

Uncaught SyntaxError: Use of const in strict mode.

Firstly, how can i avod this error ? How does the strict mode get enabled in this case ?

EDIT:

{
  "compileOnSave": false,
  "compilerOptions": {
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2017",
      "dom"
    ]
  }
}
Fenton
  • 241,084
  • 71
  • 387
  • 401

1 Answers1

0

Similar issue resolved in below GitHub discussion Link

Below is how the issue was handled, trying this may help you resolve the issue.

If you have a working version prior to update go to that installation and use:

npm shrinkwrap 
or npm shrinkwrap --dev

then a new file will be created

npm-shrinkwrap.json

Check that file and make sure dependencies are created. Normally this file has all the existing dependencies. Put that file in the folder which you run npm install inside. NPM will use the old versions and should work.

As an alternative you can remove all unrelated dependencies and keep only node-sass with request dependency.

        "node-sass": {
        "version": "2.1.1",
        "from": "node-sass@>=2.0.1 <3.0.0",
        "resolved": "https://registry.npmjs.org/node-sass/-/node-sass-2.1.1.tgz",
        "dependencies": {
          "request": {
            "version": "2.79.0",
            "from": "request@>=2.53.0 <3.0.0",
            "resolved": "https://registry.npmjs.org/request/-/request-2.79.0.tgz",
          },
        }
      },
Cyrus
  • 15
  • 5