core icon indicating copy to clipboard operation
core copied to clipboard

Cannot find module, when running in Windows enviroment

Open hugocalheira opened this issue 5 years ago • 7 comments

A project that is a exact clone from Jack Harrington's nextjs-mf. Nothing has changed. But when I try to run in Windows (only), I got this error: error

But when running in linux, everything goes well.

The path in next.config.js

        // For SSR, resolve to disk path (or you can use code streaming if you have access)
        home: isServer
          ? path.resolve(
              __dirname,
              "../home/.next/server/static/runtime/remoteEntry.js"
            )
          : "home", // for client, treat it as a global
      }```

hugocalheira avatar Jan 18 '21 06:01 hugocalheira

Unfortunately I don't have a convenient Windows machine to try this on. Perhaps someone else does who can debug through the issue.

jherr avatar Jan 18 '21 16:01 jherr

image

Something is kidnapping all the \ and 2 r (\r) in the path!

Trying to debug: image So far, so good... but I don't know where to look more.

hugocalheira avatar Jan 18 '21 18:01 hugocalheira

Well I found a workaround...

image https://github.com/sindresorhus/slash

So, I add this to the project yarn add slash and resolve my pdp/next.config.js like this: image

Finally, my pdp app run with the Header component from home! image

hugocalheira avatar Jan 18 '21 19:01 hugocalheira

Nice! Great work!

jherr avatar Jan 18 '21 19:01 jherr

Yes am having the same issue here, but actaully the slash lib is genius until this bug is fixed, thanks a lot!

mohux avatar Jan 24 '21 06:01 mohux

Boa Hugo, thanks man. it worked here.

jordan-braz avatar Feb 18 '21 20:02 jordan-braz

@hugocalheira you are a Crack! I had been trying to solve this error for about 5 days. Thank you very much for sharing man!! :)

bravoy93 avatar Mar 22 '21 04:03 bravoy93