cli icon indicating copy to clipboard operation
cli copied to clipboard

Error: EISDIR: illegal operation on a directory, read

Open xcfio opened this issue 1 year ago • 0 comments

Describe the bug

C:\SoftwareXPlus\Project\Website\ubg --> netlify dev
◈ Netlify Dev ◈
◈ Injecting environment variable values for all scopes
◈ Ignored general context env var: LANG (defined in process)
◈ Injected .env file env var: URI
◈ Injected .env file env var: SALT
◈ Injected .env file env var: COOKIE_SECRET
◈ Injected .env file env var: JWT_SECRET
◈ No app server detected. Using simple static server
◈ Unable to determine public folder to serve files from. Using current working directory
◈ Setup a netlify.toml file with a [dev] section to specify your dev server settings.   
◈ See docs at: https://docs.netlify.com/cli/local-development/#project-detection        
◈ Running static server from "ubg"
◈ Setting up local development server
Cleaned up .netlify\functions-internal.

◈ Static server listening to 3999

   ┌─────────────────────────────────────────────────┐
   │                                                 │
   │   ◈ Server now ready on http://localhost:8888   │
   │                                                 │
   └─────────────────────────────────────────────────┘

=============

WARNING: You are currently running a version of TypeScript which is not officially supported by @typescript-eslint/typescript-estree.

You may find that it works just fine, or you may not.

SUPPORTED TYPESCRIPT VERSIONS: >=3.3.1 <5.2.0

YOUR TYPESCRIPT VERSION: 5.5.4

Please only submit bug reports when using the officially supported version.

=============
◈ Failed to load function api: EISDIR: illegal operation on a directory, read

 »   Error: Netlify CLI has terminated unexpectedly
This is a problem with the Netlify CLI, not with your application.
If you recently updated the CLI, consider reverting to an older version by running:

npm install -g netlify-cli@VERSION

You can use any version from https://ntl.fyi/cli-versions.

Please report this problem at https://ntl.fyi/cli-error including the error details below.

Error: EISDIR: illegal operation on a directory, read
    at readFileHandle (node:internal/fs/promises:554:24)
    at getDependenciesForModuleName (file:///C:/Users/it%20life/AppData/Local/pnpm/global/5/.pnpm/@[email protected][email protected]/node_modules/@netlify/zip-it-and-ship-it/dist/runtimes/node/bundlers/zisi/traverse.js:42:36)
    at getDependencyPathsForDependency (file:///C:/Users/it%20life/AppData/Local/pnpm/global/5/.pnpm/@[email protected][email protected]/node_modules/@netlify/zip-it-and-ship-it/dist/runtimes/node/bundlers/zisi/traverse.js:20:16)
    at async Promise.all (index 12)
    at getNestedModules (file:///C:/Users/it%20life/AppData/Local/pnpm/global/5/.pnpm/@[email protected][email protected]/node_modules/@netlify/zip-it-and-ship-it/dist/runtimes/node/bundlers/zisi/traverse.js:59:23)
    at async Promise.all (index 2)
    at getDependenciesForModuleName (file:///C:/Users/it%20life/AppData/Local/pnpm/global/5/.pnpm/@[email protected][email protected]/node_modules/@netlify/zip-it-and-ship-it/dist/runtimes/node/bundlers/zisi/traverse.js:43:52)
    at getDependencyPathsForDependency (file:///C:/Users/it%20life/AppData/Local/pnpm/global/5/.pnpm/@[email protected][email protected]/node_modules/@netlify/zip-it-and-ship-it/dist/runtimes/node/bundlers/zisi/traverse.js:20:16)
    at getSrcFilesForDependency (file:///C:/Users/it%20life/AppData/Local/pnpm/global/5/.pnpm/@[email protected][email protected]/node_modules/@netlify/zip-it-and-ship-it/dist/runtimes/node/bundlers/esbuild/src_files.js:39:23)
    at async Promise.all (index 0)

  System:
    OS: Windows 10 10.0.19045
    CPU: (8) x64 Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz
  Binaries:
    Node: 22.6.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.8.2 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Chromium (127.0.2651.74)

Steps to reproduce

create those file and install dependencies

netlify\functions\api.ts
import serverless from "serverless-http"
import fastify from "../../src/index"
import { config } from "dotenv"

config()
export const handler = serverless(fastify as any)
src\index.ts
import Router from "fastify"
import JWT from "@fastify/jwt"
import Cookie from "@fastify/cookie"

const fastify = Router()

fastify.register(JWT, { secret: process.env.JWT_SECRET })
fastify.register(Cookie, { secret: process.env.COOKIE_SECRET })

fastify.get("/", () => process.env)

export default fastify
package.json
{
    "name": "cool",
    "version": "1.0.0",
    "main": "index.js",
    "scripts": {
        "dev": "netlify dev",
        "test": "tsc --watch --noEmit"
    },
    "dependencies": {
        "@fastify/cookie": "^9.4.0",
        "@fastify/jwt": "^8.0.1",
        "@netlify/functions": "^2.8.1",
        "dotenv": "^16.4.5",
        "fastify": "^4.28.1",
        "postgres": "^3.4.4",
        "serverless-http": "^3.2.0"
    },
    "devDependencies": {
        "@types/node": "^22.4.2"
    }
}

now run netlify dev

Configuration

[functions]
  external_node_modules = ["fastify"] # here if i use `express` instead of fastify then it works fine
  node_bundler = "esbuild"
[[redirects]]
  force = true
  from = "*"
  status = 200
  to = "/.netlify/functions/api/:splat"

Environment

System: OS: Windows 10 10.0.19045 CPU: (8) x64 Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz Memory: 516.97 MB / 3.90 GB Binaries: Node: 22.6.0 - C:\Program Files\nodejs\node.EXE
npm: 10.8.2 - C:\Program Files\nodejs\npm.CMD
pnpm: 9.7.1 - ~\AppData\Local\pnpm\pnpm.CMD bun: 1.1.20 - ~.bun\bin\bun.EXE

xcfio avatar Aug 21 '24 13:08 xcfio