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

yarn 2 Qualified path resolution failed - none of the candidates can be found on the disk. #1866

Closed
mdbetancourt opened this issue Sep 15, 2020 · 9 comments

Comments

@mdbetancourt
Copy link

mdbetancourt commented Sep 15, 2020

image
looks like the problem is in the following code

function connectorModuleNames(name) {
  const names = []; // Check the name as is
  if (!name.match(/^\//)) {
    names.push('./connectors/' + name); // Check built-in connectors
    if (name.indexOf('loopback-connector-') !== 0) {
      names.push('loopback-connector-' + name); // Try loopback-connector-<name>
    }
  }
  // Only try the short name if the connector is not from StrongLoop
  if (['mongodb', 'oracle', 'mysql', 'postgresql', 'mssql', 'rest', 'soap', 'db2', 'cloudant']
    .indexOf(name) === -1) {
    names.push(name);
  }
  return names;
}

trying to check for rest file in connector folder but there no exists

i fixed it with

function connectorModuleNames(name) {
  const names = []; // Check the name as is
  if (!name.match(/^\//)) {
    if(['kv-memory', 'memory', 'transient'].indexOf(name) !== -1) {
      console.log(name)
      names.push('./connectors/' + name); // Check built-in connectors

    } else if (name.indexOf('loopback-connector-') !== 0) {
      names.push('loopback-connector-' + name); // Try loopback-connector-<name>
    }
  }
  // Only try the short name if the connector is not from StrongLoop
  if (['mongodb', 'oracle', 'mysql', 'postgresql', 'mssql', 'rest', 'soap', 'db2', 'cloudant']
    .indexOf(name) === -1) {
    names.push(name);
  }
  return names;
}
@mdbetancourt
Copy link
Author

a workaround is use the full name
{
connector: "loopback-connector-rest" instead of "rest"
}

@ferrantejake
Copy link

I am having the same issue with the mongodb connector. It is not resolved by using the connectors full name.

Cannot start the application. Error: Qualified path resolution failed - none of the candidates can be found on the disk.

Source path: C:\Users\jakef\code\examplerepo\.yarn\cache\loopback-datasource-juggler-npm-4.26.0-67d3cf0749-75cc866df5.zip\node_modules\loopback-datasource-juggler\lib\connectors\loopback-connector-mongodb
Rejected candidate: C:\Users\jakef\code\examplerepo\.yarn\cache\loopback-datasource-juggler-npm-4.26.0-67d3cf0749-75cc866df5.zip\node_modules\loopback-datasource-juggler\lib\connectors\loopback-connector-mongodb
Rejected candidate: C:\Users\jakef\code\examplerepo\.yarn\cache\loopback-datasource-juggler-npm-4.26.0-67d3cf0749-75cc866df5.zip\node_modules\loopback-datasource-juggler\lib\connectors\loopback-connector-mongodb.js
Rejected candidate: C:\Users\jakef\code\examplerepo\.yarn\cache\loopback-datasource-juggler-npm-4.26.0-67d3cf0749-75cc866df5.zip\node_modules\loopback-datasource-juggler\lib\connectors\loopback-connector-mongodb.json
Rejected candidate: C:\Users\jakef\code\examplerepo\.yarn\cache\loopback-datasource-juggler-npm-4.26.0-67d3cf0749-75cc866df5.zip\node_modules\loopback-datasource-juggler\lib\connectors\loopback-connector-mongodb.node

@mdbetancourt
Copy link
Author

I am having the same issue with the mongodb connector. It is not resolved by using the connectors full name.

do you have installed mongodb connector? try using .yarnrc.yml to specify the dependency

@ferrantejake
Copy link

Yes, I do. The issue lies in the way datasource-juggler tries to look up multiple versions of the connector by looking in different locations and fails entirely when it fails on any of the locations it tries to look up. See this pull request.
#1883

@bajtos
Copy link
Member

bajtos commented Feb 26, 2021

Another option is to pass the connector object instead of the module name.

// LB4 datasource config
const config = {
  connector: require('loopback-connector-mongodb'),
  // ...
};

@instantlinux
Copy link

I've upgraded to yarn 2.4.1 and hit this irreconcilable error in CI; these problems are maddening and time-consuming for those of us not native to the javascript frontend world:

Qualified path resolution failed - none of the candidates can be found on the disk.
    Source path: /builds/instantlinux/apicrud-ui/.yarn/$$virtual/@blackbox-vision-ra-language-spanish-virtual-229dab0f27/0/cache/@blackbox-vision-ra-language-spanish-npm-3.12.2-f02804f106-3619e7ae0a.zip/node_modules/@blackbox-vision/ra-language-spanish/
    Rejected candidate: /builds/instantlinux/apicrud-ui/.yarn/$$virtual/@blackbox-vision-ra-language-spanish-virtual-229dab0f27/0/cache/@blackbox-vision-ra-language-spanish-npm-3.12.2-f02804f106-3619e7ae0a.zip/node_modules/@blackbox-vision/ra-language-spanish/

This comes from the following line in App.js:

import spanishMessages from '@blackbox-vision/ra-language-spanish';

Somehow it's getting confused by the @ or something, generating an incorrect path for that one (out of dozens) of packages. My current workaround is to turn off the feature that this import enables: Spanish language translations. But that's hardly satisfying. It's hard to gather info to submit my own bug report, because the problem only happens in my CI builds (on throwaway containers).

@lensbart
Copy link

@instantlinux if the issue only arises in CI, check if your ignore file (e.g. .ebignore for AWS Elastic Beanstalk) matches the path not being found.

In my case, I had src in my ignore file instead of ./src, so it left out some subdirectory from a subdependency.

I arrived here via Google, so maybe it’s not related to this issue, but it cost me a few hours to figure out, so I figured I’d share, just in case.

@stale
Copy link

stale bot commented Jul 14, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jul 14, 2021
@stale
Copy link

stale bot commented Jul 28, 2021

This issue has been closed due to continued inactivity. Thank you for your understanding. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository.

@stale stale bot closed this as completed Jul 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants