Skip to content

SyntaxError: Octal literals are not allowed in strict mode. #90

@alexgorbatchev

Description

@alexgorbatchev

After upgrading to ts-node from 0.5.4 to 0.7.1 I started seeing this error... It took me a while to find the root cause because I was looking for numbers... and searching online didn't help. I'm filing this here for future wanderers and in hope that it might be addressed somehow.

SyntaxError: Octal literals are not allowed in strict mode.
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:387:25)
    at Object.loader (.../node_modules/ts-node/src/ts-node.ts:224:14)

The issue was caused by ANSI escape code which is a string, not a number (octal literal) that starts with 0, like 0644. In my case the string was '\033[0m'. The solution was to replace it with '\u001b[0m'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions