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

make lint-js throws error #41771

Description

@MrJithil

Version

v18.0.0-pre

Platform

Linux 5.10.16.3-microsoft-standard-WSL2 #1 SMP Fri Apr 2 22:23:49 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

tools

What steps will reproduce the bug?

run make lint-js and observe the errors in WSL Ubuntu. I have tried the latest source on macOS and faced the same.

/mnt/e/OpenSource/node$ make lint-js
Running JS linter...

Oops! Something went wrong! :(

ESLint: 8.8.0

/mnt/e/OpenSource/node/tools/node_modules/eslint/node_modules/eslint:1
(function (exports, require, module, __filename, __dirname) { ..
                                                              ^

SyntaxError: Unexpected token '.'
    at new Script (node:vm:100:7)
    at NativeCompileCache._moduleCompile (/mnt/e/OpenSource/node/tools/node_modules/eslint/node_modules/v8-compile-cache/v8-compile-cache.js:240:18)
    at Module._compile (/mnt/e/OpenSource/node/tools/node_modules/eslint/node_modules/v8-compile-cache/v8-compile-cache.js:184:36)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1149:10)
    at Module.load (node:internal/modules/cjs/loader:975:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:999:19)
    at require (/mnt/e/OpenSource/node/tools/node_modules/eslint/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
    at Object.<anonymous> (/mnt/e/OpenSource/node/tools/node_modules/eslint/node_modules/eslint-plugin-jsdoc/dist/rules/checkExamples.js:8:15)
    at Module._compile (/mnt/e/OpenSource/node/tools/node_modules/eslint/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
make: *** [Makefile:1352: lint-js] Error 2

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

Always

What is the expected behavior?

Linters should run successfully.

What do you see instead?

Errors and linting broken

Additional information

No response

Activity

  1. Trott commented on Jan 30, 2022

    @Trott
    Member

    If you haven't compiled Node.js locally, make lint-js will use the version of node in your path. So I'm guessing you have Node.js 10.x or older installed. Node.js 10.x is unsupported and will result in this error.

    To fix the issue, you can either build Node.js locally (no need to install it--just having it built in the your project directory will be enough) or update your system Node.js to 12.x or newer.

  2. MrJithil commented on Jan 30, 2022

    @MrJithil
    MemberAuthor

    I'm using the locally built version v18.0.0-pre and the installed version is v16.13.2

    image

  3. Trott commented on Jan 30, 2022

    @Trott
    Member

    @MrJithil OK, that's surprising. What happens if you run tools/node_modules/eslint/bin/eslint.js from the command line?

  4. Trott commented on Jan 30, 2022

    @Trott
    Member

    @MrJithil OK, that's surprising. What happens if you run tools/node_modules/eslint/bin/eslint.js from the command line?

    In particular, since you have the 18.0.0-pre compiled, do all three of these work?

    $ tools/node_modules/eslint/bin/eslint.js
    $ node tools/node_modules/eslint/bin/eslint.js
    $ ./node tools/node_modules/eslint/bin/eslint.js
    $ 
  5. MrJithil commented on Jan 30, 2022

    @MrJithil
    MemberAuthor

    Except for the first one, the rest of them are executing well.
    image

    But, it's not a throwing error while manually creating a lint error in a file.

  6. benjamingr commented on Jan 30, 2022

    @benjamingr
    Member

    Hmm, that's odd since it takes node from the environment so if node tools/node_modules/eslint/bin/eslint.js passes then tools/node_modules/eslint/bin/eslint.js should too.

    It might be a WSL related issue? (though why would it?) there is probably something else at play based on the environment.

  7. Trott commented on Jan 30, 2022

    @Trott
    Member

    Seems like the problem is happening in call available-node in the Makefile. Let's confirm that.

    Does make tools/doc/node_modules fail in a similar way? Or does that succeed?

  8. added
    toolsIssues and PRs related to the tools directory.
    on Jan 30, 2022
  9. MrJithil commented on Jan 31, 2022

    @MrJithil
    MemberAuthor

    image
    Seems return success.

  10. Trott commented on Jan 31, 2022

    @Trott
    Member

    image Seems return success.

    The way make works, that didn't run anything because the target is already built. Do this to cause make to try to run the recipe:

    touch tools/doc/package.json && make tools/doc/node_modules
    

    If that fails, at least we have a narrow area to find the cause of the problem. If that succeeds, the search continues....

  11. MrJithil commented on Feb 1, 2022

    @MrJithil
    MemberAuthor

    touch: setting times of 'tools/doc/package.json': Invalid argument

    Got this error

  12. Trott commented on Feb 1, 2022

    @Trott
    Member

    touch: setting times of 'tools/doc/package.json': Invalid argument

    Got this error

    OK, instead of using touch, how about remove tools/doc/node_modules and then run make tools/doc/node_modules?

  13. MrJithil commented on Feb 1, 2022

    @MrJithil
    MemberAuthor

    Sorry. I ran the previous command in the wrong shell. Now, I corrected it and ran touch tools/doc/package.json && make tools/doc/node_modules again.

    Waiting for the results.

    Seems like its taking time.

  14. MrJithil commented on Feb 1, 2022

    @MrJithil
    MemberAuthor

    image
    Here is the error for touch tools/doc/package.json && make tools/doc/node_modules

    Trying now with remove tools/doc/node_modules and then run make tools/doc/node_modules

  15. MrJithil commented on Feb 1, 2022

    @MrJithil
    MemberAuthor

    And below is the output @Trott
    image

  16. Trott commented on Feb 1, 2022

    @Trott
    Member

    Are you sure you removed tools/doc/node_modules before running make tools/doc/node_modules? Can you confirm that whatever command you use to remove it succeeded? Maybe do a directory listing and confirm that it's not there? There's no way that removing the directory and then running make tools/doc/node_modules should report that the directory, which you just removed, is up to date. So either the directory was not removed, or else something is truly deeply broken with make (or something make depends on) in your setup.

  17. MrJithil commented on Feb 2, 2022

    @MrJithil
    MemberAuthor

    Hello @Trott, Finally discovered the issue.

    wsl instance unable to resolve the npm.org was the underlying issue. I have changed the DNS resolver to 8.8.8.8 and restarted the systemd-networkd service. After restarting the windows, I am able to run make tools/doc/node_modules successfully.

    Also, as you suggested tools/doc/node_modules directory is hidden and not showing in the filesystem. I have run the rm -r tools/doc/node_modules to ensure this is completely removed from the disk.

    All good now. Thank you again @Trott for your kind support and a lot of effort to fix this case.

  18. Trott commented on Feb 2, 2022

    @Trott
    Member

    Glad you got it worked out!

  19. Mesteery commented on Feb 17, 2022

    @Mesteery
    Contributor

    I have the same issue on Windows (outside WSL):

    PS C:\Users\x\workspace\nodejs\node> node -v
    v16.13.0
    PS C:\Users\x\workspace\nodejs\node> node tools/node_modules/eslint/bin/eslint.js .eslintrc.js benchmark doc lib test tools        
    
    Oops! Something went wrong! :(
    
    ESLint: 8.9.0
    
    C:\Users\x\workspace\nodejs\node\tools\node_modules\eslint\node_modules\eslint:1
    (function (exports, require, module, __filename, __dirname) { ..
                                                                  ^
    
    SyntaxError: Unexpected token '.'
        at new Script (node:vm:100:7)
        at NativeCompileCache._moduleCompile (C:\Users\x\workspace\nodejs\node\tools\node_modules\eslint\node_modules\v8-compile-cache\v8-compile-cache.js:240:18)
        at Module._compile (C:\Users\x\workspace\nodejs\node\tools\node_modules\eslint\node_modules\v8-compile-cache\v8-compile-cache.js:184:36)
        at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
        at Module.load (node:internal/modules/cjs/loader:981:32)
        at Function.Module._load (node:internal/modules/cjs/loader:822:12)
        at Module.require (node:internal/modules/cjs/loader:1005:19)
        at require (C:\Users\x\workspace\nodejs\node\tools\node_modules\eslint\node_modules\v8-compile-cache\v8-compile-cache.js:159:20)
        at Object.<anonymous> (C:\Users\x\workspace\nodejs\node\tools\node_modules\eslint\node_modules\eslint-plugin-jsdoc\dist\rules\checkExamples.js:8:15)
        at Module._compile (C:\Users\x\workspace\nodejs\node\tools\node_modules\eslint\node_modules\v8-compile-cache\v8-compile-cache.js:192:30)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    toolsIssues and PRs related to the tools directory.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions