Skip to content

File path not recognized when executing 'yarn dev' #4701

@callqh

Description

@callqh

Describe the bug

I introduced a third-party library called 'event-emitter' into my project and it threw an error when executing 'yarn dev' that the contents of the file could not be read
image

Reproduction

https://github.com/liuqh0609/vite-test

System Info

System:
    OS: macOS 11.5.2
    CPU: (8) x64 Intel(R) Core(TM) i5-1038NG7 CPU @ 2.00GHz
    Memory: 137.72 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.17.2 - /usr/local/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 6.14.13 - /usr/local/bin/npm
    Watchman: 2021.06.07.00 - /usr/local/bin/watchman
  Browsers:
    Chrome: 92.0.4515.159
    Safari: 14.1.2

Used Package Manager

yarn

Logs

> node_modules/d/index.js:7:30: error: Could not read from file: /Users/xxx/61/vite-project/node_modules/es5-ext/string/index.js#/contains
    7 │   , contains        = require("es5-ext/string/#/contains");~~~~~~~~~~~~~~~~~~~~~~~~~~~

error when starting dev server:
Error: Build failed with 1 error:
node_modules/d/index.js:7:30: error: Could not read from file: /Users/xxx/61/vite-project/node_modules/es5-ext/string/index.js#/contains
    at failureErrorWithLog (/Users/xxx/61/vite-project/node_modules/esbuild/lib/main.js:1449:15)
    at /Users/xxx/61/vite-project/node_modules/esbuild/lib/main.js:1131:28
    at runOnEndCallbacks (/Users/xxx/61/vite-project/node_modules/esbuild/lib/main.js:921:63)
    at buildResponseToResult (/Users/xxx/61/vite-project/node_modules/esbuild/lib/main.js:1129:7)
    at /Users/xxx/61/vite-project/node_modules/esbuild/lib/main.js:1236:14
    at /Users/xxx/61/vite-project/node_modules/esbuild/lib/main.js:609:9
    at handleIncomingPacket (/Users/xxx/61/vite-project/node_modules/esbuild/lib/main.js:706:9)
    at Socket.readFromStdout (/Users/xxx/61/vite-project/node_modules/esbuild/lib/main.js:576:7)
    at Socket.emit (events.js:375:28)
    at Socket.emit (domain.js:470:12)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions