Cannot find module 'gatsby-core-utils/fetch-remote-file' #34929
Replies: 5 comments 1 reply
-
Hi! You might want to open an issue on https://github.com/standard-things/esm as the way we declare the exports on the package is correct. |
Beta Was this translation helpful? Give feedback.
-
Hey @justinh00k. Any luck on solving this issue? I am quite desperate already.. |
Beta Was this translation helpful? Give feedback.
-
any success with this so far? having the same issue. |
Beta Was this translation helpful? Give feedback.
-
I thought this issue was gonna be easy to solve, and then found this. It's weird because the Gatsby project works perfectly in my local, but as soon as I push and the CI/CD pipeline is triggered the compilation fails because of this exception. This is the error log:
Those dotted lines mean confidential names by the way |
Beta Was this translation helpful? Give feedback.
-
@AndrPetrov @Gashanas @justinh00k I fixed it by putting the required part inside the gatsby-node.js like so: gatsby-node.esm.js export async function createPages({ graphql, actions, reporter }) {
// ...
} gatsby-node.js const { createRemoteFileNode } = require(`gatsby-source-filesystem`)
const requireEsm = require('esm')(module)
module.exports = {
...requireEsm('./gatsby-node.esm.js'),
createResolvers: ({ createResolvers }) => {
// ....
},
} |
Beta Was this translation helpful? Give feedback.
-
Preliminary Checks
Description
I am using esm to use modules in gatsby-node.js. So my gatsby-node.js looks like this:
In gatsby-node.esm.js, this line causes an error:
import { createRemoteFileNode } from "gatsby-source-filesystem"
I can fix the problem by modifying this line in gatsby-source-filesystem/create-remote-file-node.js
const { fetchRemoteFile } = require(
gatsby-core-utils/fetch-remote-file);
to
const { fetchRemoteFile } = require(
gatsby-core-utils);
Reproduction Link
https://github.com/justinh00k/crfn-bug-repro
Steps to Reproduce
Install Esm
Add this to gatsby-node.js
const requireEsm = require("esm")(module)
module.exports = requireEsm("./gatsby-node.esm.js")
In gatsby-node-esm.js, import this:
import { createRemoteFileNode } from "gatsby-source-filesystem"
Expected Result
This was working fine until today, allowing for use of createRemoteFileNode function.
Actual Result
Returns error:
Environment
Config Flags
No response
Beta Was this translation helpful? Give feedback.
All reactions