I have been running an EmberJS app and I just installed a new package using Yarn graphql@0.13.0. For sanity, I checked my package.json file and it is in there. Also when I run yarn list --depth=0, I can see that the package was successfully installed.
├─ graphql-tag@2.10.1
├─ graphql-tools@2.24.0
├─ graphql@0.13.0
I start my Ember app and I get this error straight away.
Uncaught Error: Could not find module
graphql
imported from `ember-cli-mirage-graphql/related-records
I checked ember-cli-mirage-graphql to see if it was a dependency version issue, but the graphql dependency of ember-cli-mirage-graphql is 0.13.0. I went into the stack trace where the exception is happening, to debug the issue at /assets/vendor/loader/loader.js. There is a function that takes a dependency name, in this case I could see it was 'graphql', and uses that as a key to a registry dictionary to find and load the package. I looked into the registry and could see that a lot of other packages I expected to find were in fact there and it was only that package that was missing.
function missingModule(id, referrer) {
throw new Error('Could not find module `' + id + '` imported from `' + referrer + '`');
}
function findModule(id, referrer, pending) {
var mod = registry[id] || registry[id + '/index'];
while (mod && mod.isAlias) {
mod = registry[mod.id] || registry[mod.id + '/index'];
}
if (!mod) {
missingModule(id, referrer);
}
if (pending && mod.state !== 'pending' && mod.state !== 'finalized') {
mod.findDeps(pending);
pending.push(mod);
}
return mod;
}
I looked online, but couldn't find anything helpful. What registry is this and why isn't it updated with the new package I installed? Is there a way I can reset the registry?
Aucun commentaire:
Enregistrer un commentaire