-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[no-unresolved]: Unable to resolve path to module with node: protocol specifier #2031
Comments
Indeed; the new protocol support isn’t added to |
Great! ...uh where would issues to |
resolve is https://github.com/browserify/resolve but it's actually in https://github.com/inspect-js/is-core-module now, and I'm already working on it :-) so no worries. Can you cite a reference for where it will be backported? I'm pretty sure the addition of |
Ah ok, thanks :) Here's where I read from @jasnell about the backporting at least to v14 ("hopefully soon" |
the "take a while" was referring to when it will be safe for library authors to use that syntax :-) "hopefully" is what describes the backporting. |
Ah right, misread this one, good point! |
is-core-module v2.3.0 has been released, which should address the problem. |
Hmm, just upgraded all versions of the transitive deps on |
Is eslint running on node 16? Perhaps you’re in vscode, and it’s using its bundled copy of node? |
Ah yeah, in VSCode ESLint extension, it's still using Node 12:
But on the command line, all is good! 🙌 |
To avoid issues like this: import-js/eslint-plugin-import#2031 (comment)
@ljharb I'm running eslint v7.32.0 on node v14.16.0 and I'm still getting Is this expected to work on v14 or is it necessary to upgrade to v16? |
@andreavaccari the |
Support for |
@bmish aha, well then that's what i was missing :-) i can update |
☝️ what @bmish says - but only for ESM. For CJS node 14.17.5 and node 12.22.1 still barf with |
ahhh, that's more complicated then. In that case, there's nothing I can really do about it until |
Thanks for clarifying the situation! I reverted to the traditional imports and turned off |
I'd suggest keeping that rule off anyways; the advantage to using |
When I try
node: v16.13.2 I reinstalled "eslint-plugin-import" and its package file claims its using "is-core-module": "^2.8.0". I'm not using unicorn but plan to in the future. How can I troubleshoot this problem? |
@TriStarGod is this on the command line, or in your editor? vscode bundles its own node 12, i believe. |
@ljharb Its in the vscode editor |
@TriStarGod so that's your problem. On the command line, it will work fine. That means your "fix" is either "don't use |
@ljharb My vscode version is 1.63.2 and its using Node.js 14.16.0 . I believe Node.js 14 is also suppose to support Doesn't |
@TriStarGod that support was added in node v14.18, so v14.16 is too old for that. No, if you import from |
@TriStarGod you're probably looking for the following setting in your VS Code
|
@karlhorky I tried it and "eslint.runtime": "C:\Program Files\nodejs\node.exe" but both didn't work. I'll take @ljharb advice and not even use it since there isn't any benefit. |
Sorry to reignite the discussion, but this rule still seems to throw for CJS when requiring built-in modules with the I'm using Node v14.19.1, and when using Any chance of it being revisited for Node >=14.18? 🙏 |
@acidoxee i've got lots of tests in is-core-module that this already works. Where does the rule error out - on the terminal or in an IDE? |
I've got both my terminal and IDE running the same Node version, and yielding the same error. Given the previous problems people had with bad IDE config, I ran ESLint from the terminal to be sure not to bother you for the same mistake, and I can confirm I'm having the same error. I'll try to setup a minimal project to try and reproduce the error on the same Node and package versions. |
@acidoxee thanks; can you also confirm you have the latest version of |
There's indeed a bunch of different versions of it in my lockfile because of several packages that require them, but the version present at the very root of my As there's no |
yep, that sounds right. i just released v2.9.0 but that shouldn't affect this. If you could file a new issue that'd be great. |
Sure, I'll continue this tomorrow and keep you updated. Thanks for your help! |
Bad news, I couldn't reproduce the error with a minimal setup. My current ESLint config has a lot more plugins, configs and overrides than the example I was trying to set up, which seems to work great despite having exactly the same Node and package versions (I verified them manually in the lockfile and in my I don't really know what could make the rule fail in my current full-size setup, which is configured exactly the same, regarding the import plugin at least 😕 I absolutely can't downsize my current project bit by bit, because it's a huge monorepo with 30+ packages where ESLint was completely absent, so removing each piece to try the rule again would take forever. I'll put this on the side for a while since I can't afford to spend much more time on this. Thanks for your help anyway @ljharb and for your reactivity, I'll ping you someday if I ever figure it out! |
If it's a monorepo, you may have a central |
To avoid issues like this: import-js/eslint-plugin-import#2031 (comment)
Hi there, thanks for this plugin, super useful! 👍
Ran into an issue when using the new
node:
prefix for builtin / core modules (currently in v16, but will be backported):import/no-unresolved
cannot resolve the path to the module:The text was updated successfully, but these errors were encountered: