Skip to content

Run script from the console with UTF-8 with BOM #39111

@arteze

Description

@arteze

From Linux I make a script with shebang:

#!/bin/node

// Code...

But when I transformed it to UTF-8 with BOM it does not run.

line 1: ���#!/bin/node: No such file or directory

Seeing this I just realized that it is a problem of the terminal and not of Node, but if I run it with Node, the problem is still.

node script.js

Answer in LxTerminal:

���#!/bin/node

Answer on Sakura:

#!/bin/node
 ^

SyntaxError: Invalid or unexpected token
    at Object.compileFunction (node:vm:353:18)
    at wrapSafe (node:internal/modules/cjs/loader:1039:15)
    at Module._compile (node:internal/modules/cjs/loader:1073:27)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1138:10)
    at Module.load (node:internal/modules/cjs/loader:989:32)
    at Function.Module._load (node:internal/modules/cjs/loader:829:14)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
    at node:internal/main/run_main_module:17:47

Metadata

Metadata

Assignees

No one assigned

    Labels

    moduleIssues and PRs related to the module subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions