镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Core/Javascripting/1.Introduction #215

Description

@AlexanderOpran

On Windows 10, in PowerShell, you cannot create an empty file using the type NUL > file.extension command.
The only way for the javascripting verifiy command to ever be successful is to create an empty file using the type NUL > file.extension command from CommandPrompt only. This isn't mentioned anywhere in the guide (it just says on Windows).
Even if you create an empty file with $null > file.extension, the validation fails and you can't even run it with node file.extension. The same applies when you create the file in a text editor or in an IDE.

  • node version: v9.3.0
  • npm version: 5.6.0
  • os: Microsoft Windows [Version 10.0.16299.125]

Error output when trying to verify a file that was not created in CommandPrompt using the type NUL > file.extension command.

SyntaxError: Invalid or unexpected token
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:152:10)
    at Module._compile (module.js:624:28)
    at Object.Module._extensions..js (module.js:671:10)
    at Module.load (module.js:573:32)
    at tryModuleLoad (module.js:513:12)
    at Function.Module._load (module.js:505:3)
    at Function.Module.runMain (module.js:701:10)
    at startup (bootstrap_node.js:194:16)
    at bootstrap_node.js:618:3

    at ChildProcess.exithandler (child_process.js:272:12)
    at ChildProcess.emit (events.js:159:13)
    at maybeClose (internal/child_process.js:943:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
  killed: false,
  code: 1,
  signal: null,

My Code

 console.log('hello');

Activity

  1. AlexanderOpran commented on Dec 23, 2017

    @AlexanderOpran
    Author

    Solution (For PowerShell)

    Use the following command when creating the empty file:
    New-Item -Name file.extension -ItemType File

  2. itzsaga commented on Feb 19, 2018

    @itzsaga
    Member

    Thanks @AlexanderOpran. I'll do my best to test this and see if I can replicate this week. If so, I'll work on updating the wording.

  3. self-assigned this
    on Feb 19, 2018
  4. removed their assignment
    on Sep 26, 2019
  5. ledsun commented on Aug 24, 2026

    @ledsun
    Collaborator

    English and Japanese were updated in commit 5856be8 to document separate file-creation commands for PowerShell and Command Prompt. Here is a checklist to keep track of the remaining translations being updated:

    • en
    • es
    • fr
    • it
    • ja
    • ko
    • nb-no
    • nl
    • pt-br
    • ru
    • uk
    • zh-cn
    • zh-tw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions