Skip to content

--use-strict does not work since node 10 #39996

@ryanbai1412

Description

@ryanbai1412

Version

v10.24.1

Platform

Linux LAPTOP 5.11.0-27-generic #29~20.04.1-Ubuntu SMP Wed Aug 11 15:58:17 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?

$ cat file.js
a = 0;
console.log("strict mode not enabled");

$ node --use-strict file.js
strict mode not enabled

How often does it reproduce? Is there a required condition?

Reproduces for latest node releases for versions 10, 12, 14, 16

node/10.24.1
node/12.22.6
node/14.17.6
node/16.8.0

Works fine for node v8.17.0

What is the expected behavior?

ReferenceError: a is not defined should be thrown

What do you see instead?

The file is not run in strict mode.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateIssues and PRs that are duplicates of other issues or PRs.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions