Site can't access public folder on running `netlify dev` but is fine when using `npm run dev`

It’s been happening recently on one of my astro sites… that when run npm run dev the site loads fine but then I run netlify dev the site loads up with the js or the css and the console shows a 404 error for the css and js files…

Response with status 404 in 3 ms.
03:20:03 PM [serve] 404                      /client.20385767.js
03:20:03 PM [serve] 404                    /HeroView.f0186e49.js
03:20:03 PM [serve] 404            /TrendingProducts.d59f2545.js
03:20:03 PM [serve] 404            /StoreFrontFooter.e04a3e95.js
◈ Rewrote URL to /.netlify/functions/entry
Request from ::1: GET /.netlify/functions/entry
Response with status 404 in 27 ms.

Frankly I don’t know what the ./netlify/functions/entry function is for? I did not create it… is it something netlify does on its own?

here’s my package.json if it helps

  "name": "@example/minimal",
  "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/netlify": "^1.3.0",
    "@astrojs/rss": "^2.1.0",
    "@astrojs/sitemap": "^1.0.1",
    "@astrojs/tailwind": "^2.1.3",
    "@astrojs/vue": "^1.2.2",
    "@headlessui/vue": "^1.7.7",
    "@heroicons/vue": "^2.0.13",
    "@nanostores/persistent": "^0.7.0",
    "@nanostores/vue": "^0.6.1",
    "@tailwindcss/aspect-ratio": "^0.4.2",
    "@tailwindcss/forms": "^0.5.3",
    "@tailwindcss/typography": "^0.5.9",
    "astro": "^1.9.0",
    "dotenv": "^16.0.3",
    "nanostores": "^0.7.1",
    "netlify-cli": "^12.9.2",
    "razorpay": "^2.8.4",
    "sass": "^1.58.0",
    "tailwindcss": "^3.2.4",
    "vue": "^3.2.45"

I was planning to upgrade my astro to version 2 but I’d like to resolve this issue before I do…


I went ahead and updated to astro 2.0.6 and it’s still the same as in it works fine with npm run dev but with netlify dev I am now getting this error

Error: Build failed with 1 error:
.netlify/functions-internal/entry.mjs:16:7: ERROR: Could not resolve "path-browserify"
    at failureErrorWithLog (/home/alimbolar/.nvm/versions/node/v18.13.0/lib/node_modules/netlify-cli/node_modules/@netlify/esbuild/lib/main.js:1673:15)
    at /home/alimbolar/.nvm/versions/node/v18.13.0/lib/node_modules/netlify-cli/node_modules/@netlify/esbuild/lib/main.js:1319:28
    at runOnEndCallbacks (/home/alimbolar/.nvm/versions/node/v18.13.0/lib/node_modules/netlify-cli/node_modules/@netlify/esbuild/lib/main.js:1104:63)
    at buildResponseToResult (/home/alimbolar/.nvm/versions/node/v18.13.0/lib/node_modules/netlify-cli/node_modules/@netlify/esbuild/lib/main.js:1317:7)
    at /home/alimbolar/.nvm/versions/node/v18.13.0/lib/node_modules/netlify-cli/node_modules/@netlify/esbuild/lib/main.js:1426:14
    at /home/alimbolar/.nvm/versions/node/v18.13.0/lib/node_modules/netlify-cli/node_modules/@netlify/esbuild/lib/main.js:666:9
    at handleIncomingPacket (/home/alimbolar/.nvm/versions/node/v18.13.0/lib/node_modules/netlify-cli/node_modules/@netlify/esbuild/lib/main.js:771:9)
    at Socket.readFromStdout (/home/alimbolar/.nvm/versions/node/v18.13.0/lib/node_modules/netlify-cli/node_modules/@netlify/esbuild/lib/main.js:632:7)
    at Socket.emit (node:events:513:28)
    at Socket.emit (node:domain:489:12) {
  errors: [
      detail: undefined,
      location: {
        column: 7,
        file: '.netlify/functions-internal/entry.mjs',
        length: 17,
        line: 16,
        lineText: "import 'path-browserify';",
        namespace: '',
        suggestion: ''
      notes: [
          location: null,
          text: 'You can mark the path "path-browserify" as external to exclude it from the bundle, which will remove this error.'
      pluginName: '',
      text: 'Could not resolve "path-browserify"'
  warnings: [],
  customErrorInfo: {
    type: 'functionsBundling',
    location: { functionName: 'entry', runtime: 'js', bundler: 'esbuild' }

Node.js v18.13.0

Any ideas? I really need to use netlify dev to work locally with netlify functions … Any help/suggestions would be welcome.


Hi Alim,

What is your site name/slug?

Hi Sam

Here’s the url :

As you can see, it works fine on netlify… it’s only on localhost when I run the 'netlify dev command that I am having this issue…

Hey @alimbolar,

That function is being generated by Astro. I think this is a recent change that the function now gets generated during CLI dev process too, if I recall that did not happen previously.

However, it’d be worth mentioning about this issue to Astro, as the function is generated by them and they should be better equipped to support that.