admin管理员组文章数量:1323342
I am trying to run a deck.gl example inside a meteor app. But I am facing this error.
modules-runtime.js?hash=8587d18…:231 Uncaught Error: Cannot find module './xhr-sync-worker.js'
at makeMissingError (modules-runtime.js?hash=8587d18…:231)
at Function.require.resolve (modules-runtime.js?hash=8587d18…:263)
at xmlhttprequest.js (xml.js:30)
at fileEvaluate (modules-runtime.js?hash=8587d18…:343)
at require (modules-runtime.js?hash=8587d18…:238)
at Window.js (xml.js:30)
at fileEvaluate (modules-runtime.js?hash=8587d18…:343)
at require (modules-runtime.js?hash=8587d18…:238)
at api.js (xml.js:30)
at fileEvaluate (modules-runtime.js?hash=8587d18…:343)
However the said js module is present in the meteor app node_modules
folder.
/caseview/node_modules/jsdom/lib/jsdom/living/xhr-sync-worker.js
How can I make my app see it?. Note That I am not importing it directly in my code, as can be seen from the stack trace above. Perhaps this is a meteor bug.
I am trying to run a deck.gl example inside a meteor app. But I am facing this error.
modules-runtime.js?hash=8587d18…:231 Uncaught Error: Cannot find module './xhr-sync-worker.js'
at makeMissingError (modules-runtime.js?hash=8587d18…:231)
at Function.require.resolve (modules-runtime.js?hash=8587d18…:263)
at xmlhttprequest.js (xml.js:30)
at fileEvaluate (modules-runtime.js?hash=8587d18…:343)
at require (modules-runtime.js?hash=8587d18…:238)
at Window.js (xml.js:30)
at fileEvaluate (modules-runtime.js?hash=8587d18…:343)
at require (modules-runtime.js?hash=8587d18…:238)
at api.js (xml.js:30)
at fileEvaluate (modules-runtime.js?hash=8587d18…:343)
However the said js module is present in the meteor app node_modules
folder.
/caseview/node_modules/jsdom/lib/jsdom/living/xhr-sync-worker.js
How can I make my app see it?. Note That I am not importing it directly in my code, as can be seen from the stack trace above. Perhaps this is a meteor bug.
Share Improve this question edited Jun 4, 2017 at 15:19 fccoelho asked Jun 4, 2017 at 13:42 fccoelhofccoelho 6,20412 gold badges60 silver badges69 bronze badges 5-
What does the relevant code in your app look like? Are you attempting to import
xhr-sync-worker
directly in your code? – MasterAM Commented Jun 4, 2017 at 14:59 - No I am not importing it directly. It's being imported from some other package in the meteor stack – fccoelho Commented Jun 4, 2017 at 15:20
- More info is required, please edit your post with: Code snippet where this lib is used. – dr.dimitru Commented Jun 4, 2017 at 20:05
- I repeat, the Lib is not used in my code. The stack trace shows where it been called from. Those are all libraries from meteor framework or bundled by it during the build process. – fccoelho Commented Jun 6, 2017 at 10:21
- Have you ever found a fix for this problem? I find that this always happens when running meteor test. – Nelson Yeung Commented Jan 10, 2018 at 16:21
4 Answers
Reset to default 3I just ran into this problem and was able to resolve my issue, so I thought I'd include it here for posterity.
I had added JSDOM through NPM, and inadvertently required jsdom on both my client side and server side code.
By wrapping the require in a Meteor.isServer condition I resolved my problem.
if (Meteor.isServer) {
const jsdom = require("jsdom");
}
So if you are running into this issue double check you are not trying to run the code on the client unintentionally.
Late reply but I was facing the same problem in a meteor / react app, trying to import JSDOM in a ponent. After some long hours there's a way. Step 1 : JSOM library use relative path for require :
node_modules/jsdom/lib/jsdom/living/xhr/XMLHttpRequest-impl.js:31
const syncWorkerFile = require.resolve ? require.resolve("./xhr-sync-worker.js") : null;
Meteor build all your code so the relative path is no longer ok. Solution : replacing this line with an absolute path :
const syncWorkerFile = "${require.resolve('jsdom/lib/jsdom/living/xhr/xhr-sync-worker.js')}";
Now your app is working but if you do a meteor npm install you will have to redo this modification.
Step 2 : create and use your own package in node_modules/jsdom do a yarn pack to generate a tar.gz with your modification (jsdom use yarn so you can't use npm)
move your archive : cp ./jsdom-v18.1.1.tgz ../../dependencies/
and replace jsdom with yours freshly build: meteor npm install dependencies/jsdom-v18.1.1.tgz
I had these issues in past in Meteor where it says some file is not found in node_modules
. I don't know the exact reason why this occurs but yes it looks like some Meteor bug.
So, how I fixed this was by deleting node_modules
folder and then doing meteor npm install
again. Try this and I think this work in your case too. Let me know if it doesn't help.
I also had the same problem and it seemed to disappear when I renamed the file I was requiring JSDOM in from index.js to index.es6. I believe it have to do with the ...require(); function.
本文标签: javascriptMeteor app not finding 39xhrsyncworkerjs39Stack Overflow
版权声明:本文标题:javascript - Meteor app not finding 'xhr-sync-worker.js'? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742134656a2422316.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论