Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v.1.1.352 breaks on node.js v12 #7365

Closed
RobertCraigie opened this issue Feb 29, 2024 · 15 comments
Closed

v.1.1.352 breaks on node.js v12 #7365

RobertCraigie opened this issue Feb 29, 2024 · 15 comments
Assignees
Labels
addressed in next version Issue is fixed and will appear in next published version bug Something isn't working

Comments

@RobertCraigie
Copy link
Contributor

Describe the bug

The latest release fails to run on node.js v12 due to a module not found error:

internal/modules/cjs/loader.js:818
  throw err;
  ^

Error: Cannot find module 'node:util'
Require stack:
- /home/runner/.cache/pyright-python/1.1.352/node_modules/pyright/dist/pyright.js
- /home/runner/.cache/pyright-python/1.1.352/node_modules/pyright/index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
    at Function.Module._load (internal/modules/cjs/loader.js:667:27)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.9632 (/home/runner/.cache/pyright-python/1.1.352/node_modules/pyright/dist/pyright.js:1:610)
    at o (/home/runner/.cache/pyright-python/1.1.352/node_modules/pyright/dist/pyright.js:1:1243)
    at Object.1264 (/home/runner/.cache/pyright-python/1.1.352/node_modules/pyright/dist/vendor.js:2:794958)
    at o (/home/runner/.cache/pyright-python/1.1.352/node_modules/pyright/dist/pyright.js:1:1243)
    at Object.1476 (/home/runner/.cache/pyright-python/1.1.352/node_modules/pyright/dist/pyright-internal.js:1:441151)
    at o (/home/runner/.cache/pyright-python/1.1.352/node_modules/pyright/dist/pyright.js:1:1243) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/runner/.cache/pyright-python/1.1.352/node_modules/pyright/dist/pyright.js',
    '/home/runner/.cache/pyright-python/1.1.352/node_modules/pyright/index.js'
  ]
}

Node.js v16 tests pass, I haven't tested v14.

I don't actually know if any pyright-python users are relying on node.js v12 so if you want to drop support for v12 that'd probably be a fine solution, I can update pyright-python accordingly.

VS Code extension or command-line

v.1.1.352

@RobertCraigie RobertCraigie added the bug Something isn't working label Feb 29, 2024
@erictraut
Copy link
Collaborator

I don't think I've made any changes that would cause this, so I suspect this incompatibility came in from the pylance team. @debonte or @rchiodo, could you please investigate and advise?

@debonte
Copy link
Collaborator

debonte commented Feb 29, 2024

We upgraded to node.js v18 recently -- e955fab. I'm not sure how that impacts back-compat.

@erictraut
Copy link
Collaborator

Rich assured me that the v18 upgrade was only for the VS Code extension and the build environment — that it would not affect the CLI compatibility with v12. If it does, then that was a miss, and we should discuss.

@rchiodo
Copy link
Collaborator

rchiodo commented Feb 29, 2024

I can only guess that building with node 18 vs node 16 is causing this problem. The engine target is still 12.

@erictraut
Copy link
Collaborator

I built it with v16 this time, so that doesn't explain it.

@rchiodo
Copy link
Collaborator

rchiodo commented Feb 29, 2024

Something is pulling in 'node:util', so maybe updating a dependency caused this?

@rchiodo
Copy link
Collaborator

rchiodo commented Feb 29, 2024

Because pyright doesn't seem to reference that itself.

@rchiodo
Copy link
Collaborator

rchiodo commented Feb 29, 2024

With debug bits I can see the culprit. It's the new vscode-languageserver bits:

Error: Cannot find module 'node:util'
Require stack:
- C:\Users\rchiodo\source\repos\pyright\packages\pyright\dist\pyright.js
- C:\Users\rchiodo\source\repos\pyright\packages\pyright\index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
    at Function.Module._load (internal/modules/cjs/loader.js:667:27)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.node:util (C:\Users\rchiodo\source\repos\pyright\packages\pyright\dist\pyright.js:121:18)
    at __webpack_require__ (C:\Users\rchiodo\source\repos\pyright\packages\pyright\dist\pyright.js:255:42)
    at Object.../pyright-internal/node_modules/vscode-languageserver/lib/node/main.js (C:\Users\rchiodo\source\repos\pyright\packages\pyright\dist\vendor.js:34509:21)
    at __webpack_require__ (C:\Users\rchiodo\source\repos\pyright\packages\pyright\dist\pyright.js:255:42)
    at Object.../pyright-internal/src/analyzer/program.ts (C:\Users\rchiodo\source\repos\pyright\packages\pyright\dist\pyright-internal.js:26184:33)
    at __webpack_require__ (C:\Users\rchiodo\source\repos\pyright\packages\pyright\dist\pyright.js:255:42) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\rchiodo\\source\\repos\\pyright\\packages\\pyright\\dist\\pyright.js',
    'C:\\Users\\rchiodo\\source\\repos\\pyright\\packages\\pyright\\index.js'
  ]
}

@rchiodo
Copy link
Collaborator

rchiodo commented Feb 29, 2024

When we moved to 18 we also upgraded the vscode-languageserver bits. This commit here brought in node:util:

microsoft/vscode-languageserver-node@a57d7f1

@rchiodo
Copy link
Collaborator

rchiodo commented Feb 29, 2024

Maybe we can fake it to use something else, but I think we'll have to upgrade to 14 if we want to support the latest vscode-languageserver protocols. We needed this to support non COI cancellation in the browser for Pylance. AFAIK, Pylance and Pyright have to be in sync with respect to their vscode-languageserver versions.

@debonte
Copy link
Collaborator

debonte commented Feb 29, 2024

if we want to support the latest vscode-languageserver protocols...

FYI, the latest vscode-languageserver-node release (from today) has a bug fix that I've been waiting for. I was planning to upgrade after the upcoming Pylance stable release ships.

@erictraut
Copy link
Collaborator

I think it's fine to update the minimum node version from v12 to v14. After all, v12 is really ancient at this point.

RobertCraigie added a commit to RobertCraigie/pyright-python that referenced this issue Feb 29, 2024
@RobertCraigie
Copy link
Contributor Author

Dropping support for v12 is fine with me, thanks for investigating!

RobertCraigie added a commit to RobertCraigie/pyright-python that referenced this issue Feb 29, 2024
@erictraut erictraut added the addressed in next version Issue is fixed and will appear in next published version label Feb 29, 2024
@erictraut
Copy link
Collaborator

This is included in pyright 1.1.353, which I just published.

@acampove
Copy link

acampove commented Sep 9, 2024

Except that the newest version of nodejs that ubuntu users can install through apt is v12.22.9, at least after doing:

  662  sudo apt update
  663  sudo apt install nodejs
  664  node -v
  665  sudo apt upgrade nodejs
  666  node -v

I am using Ubuntu 22.04.3 LTS. People keep telling me to move to nix, I wonder why the default package manager prefers to install an ancient version of this nodejs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addressed in next version Issue is fixed and will appear in next published version bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants