Skip to content

Unable to resolve path to module '@sapper/app' #1509

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

Closed
soullivaneuh opened this issue Oct 20, 2019 · 13 comments
Closed

Unable to resolve path to module '@sapper/app' #1509

soullivaneuh opened this issue Oct 20, 2019 · 13 comments

Comments

@soullivaneuh
Copy link

To reproduce, install a fresh svelte template: https://github.com/sveltejs/sapper-template

If you run eslint with this plugin, you will have:

/code/src/client.js
  1:25  error  Unable to resolve path to module '@sapper/app'  import/no-unresolved

This is because @sapper/app is installed in src/node_modules instead of the root one.

Does this plugin support nested node_modules?

@soryy708
Copy link
Collaborator

soryy708 commented Oct 23, 2019

I have a monorepo project with nested node_modules and the paths are resolved correctly. Perhaps the issue is on your end? I don't see a package.json under src/.

@ljharb
Copy link
Member

ljharb commented Oct 23, 2019

there needn't be a package.json - just being in node_modules should be enough to resolve.

@soryy708
Copy link
Collaborator

Relevant discussion: #677

@soryy708
Copy link
Collaborator

soryy708 commented Oct 23, 2019

The rules get the dependencies from the nearest package.json file not the node_modules dir

Originally posted by @HenriBeck in #677 (comment)

@ljharb
Copy link
Member

ljharb commented Oct 23, 2019

That issue is for no-extraneous-dependencies, not no-unresolved. The former cares about package.json files, the latter should not.

@soullivaneuh
Copy link
Author

Perhaps the issue is on your end?

I really don't know. I just set up the template, run the given command to install it and ran eslint.

@maraisr
Copy link

maraisr commented Nov 7, 2019

We received a similar regression when we start to only support esmodules, in that we removed the main property of the package.json in favor of a module property. As soon as we did this, these errors started to appear.

@ljharb
Copy link
Member

ljharb commented Nov 9, 2019

@maraisr module is not a standard package.json field nor will it ever be supported by node; main is required until node's ESM implementation ships (at which point, it will require a different field that this plugin does not yet support)

@ljharb
Copy link
Member

ljharb commented Feb 18, 2020

node's ESM implementation has shipped, ftr - all; packages should define a "main", and/or an "exports". "module" is irrelevant, and "jsnext:main" is archaic and only supported by some bundlers.

@ljharb ljharb closed this as completed Feb 18, 2020
@henri9813
Copy link

henri9813 commented Apr 23, 2020

Hello,

I have the same issue, i setup the default sapper template with npx.

/code/src/client.js
  1:25  error  Unable to resolve path to module '@sapper/app'  import/no-unresolved

How can i solve this ?

@ljharb
Copy link
Member

ljharb commented Apr 23, 2020

@henri9813 that error means that module isn't installed on disk. install it there, or, configure a module resolver for this plugin that can resolve it to something.

@henri9813
Copy link

henri9813 commented Apr 23, 2020

Thanks,

The module is installed.

Do you have any recommendation or advise ?

Best regards

@ljharb
Copy link
Member

ljharb commented Apr 23, 2020

I'm not sure how; https://unpkg.com/@sapper/app isn't a package in the registry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants