I am trying to build an astro project to Netlify (dev) however I keep getting this error:
TypeError: The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received undefined
at new NodeError (node:internal/errors:393:5)
at createRequire (node:internal/modules/cjs/loader:1278:11)
at .netlify/functions-internal/chunks/image-pool.f66f99fb.mjs (/Users/user/sauce/project/.netlify/functions-internal/chunks/image-pool.f66f99fb.mjs:135:20)
at __init (/Users/user/sauce/project/.netlify/functions-serve/entry/src/.netlify/functions-internal/entry.js:37:59)
at /Users/user/sauce/project/.netlify/functions-internal/entry.mjs:1917:32
at processTicksAndRejections (node:internal/process/task_queues:95:5) {
code: 'ERR_INVALID_ARG_VALUE'
}
Node.js v18.12.1
/Users/user/sauce/project/.netlify/functions-serve/entry/src/.netlify/functions-internal/entry.js:37:59):
return fn2 && (res = (0, fn2[__getOwnPropNames(fn2)[0]])(fn2 = 0)), res;
};
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __export = (target, all2) => {
for (var name in all2)
__defProp(target, name, { get: all2[name], enumerable: true });
};
var __copyProps = (to2, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to2, key) && key !== except)
__defProp(to2, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to2;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// node_modules/boolean/build/lib/boolean.js
var require_boolean = __commonJS({
"node_modules/boolean/build/lib/boolean.js"(exports) {
Package.json:
{
"name": "@example/basics",
"type": "module",
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "astro dev",
"start": "astro dev",
"build": "astro build",
"preview": "astro preview",
"astro": "astro"
},
"dependencies": {
"@astrojs/alpinejs": "^0.1.2",
"@astrojs/image": "^0.11.0",
"@astrojs/mdx": "^0.11.5",
"@astrojs/netlify": "^1.3.0",
"@astrojs/sitemap": "^1.0.0",
"@astrojs/tailwind": "^2.1.1",
"@datadog/browser-rum": "^4.28.1",
"@fontsource/inter": "^4.5.14",
"@sentry/browser": "^7.28.1",
"@sentry/tracing": "^7.28.1",
"@types/alpinejs": "^3.0.0",
"alpinejs": "^3.0.0",
"astro": "^1.6.0",
"astro-feather-icons": "^1.0.2",
"astro-google-analytics": "^1.0.2",
"astro-icon": "^0.8.0",
"astro-netlify-cms": "^0.0.1",
"astro-seo": "^0.6.0",
"node-fetch": "^3.3.0",
"tailwindcss": "^3.0.24"
},
"engines": {
"node": ">=16.0.0 <19.0.0"
},
"devDependencies": {
"@tailwindcss/typography": "^0.5.7"
}
}
Building the site directly on Astro works, but when deploying to Netlify (Dev or Cloud), this error shows up when trying to load up the page. The Netlify Content Manager endpoint however is able to load up.
1 Answer 1
Turns out one of the dependencies @astrojs/image was not compatible with Netlify. After removing the dependancy and references various places, the site now works! :)
Comments
Explore related questions
See similar questions with these tags.