vitejs / vite-plugin-vue2

Vite plugin for Vue 2.7
MIT License
543 stars 46 forks source link

The argument 'path' must be a string or Uint8Array without null bytes. #63

Open merceyz opened 1 year ago

merceyz commented 1 year ago

When running vite build it fails with the following error

$ yarn vite build
vite v3.2.2 building for production...
✓ 46 modules transformed.
[vite:vue2] Could not load /vite-vue2-null-repro/node_modules/vue2-google-maps/dist/components/placeInputImpl.js?vue&type=script&src=true&lang.js?commonjs-exports (imported by node_modules/vue2-google-maps/dist/components/placeInputImpl.js?vue&type=script&src=true&lang.js): The argument 'path' must be a string or Uint8Array without null bytes. Received '\x00/vite-vue2-null-repro/node_modules/vue2-google-maps/dist/components/placeInputImpl.js'
error during build:
TypeError [PLUGIN_ERROR]: Could not load /vite-vue2-null-repro/node_modules/vue2-google-maps/dist/components/placeInputImpl.js?vue&type=script&src=true&lang.js?commonjs-exports (imported by node_modules/vue2-google-maps/dist/components/placeInputImpl.js?vue&type=script&src=true&lang.js): The argument 'path' must be a string or Uint8Array without null bytes. Received '\x00/vite-vue2-null-repro/node_modules/vue2-google-maps/dist/components/placeInputImpl.js'
    at Object.openSync (node:fs:586:10)
    at Object.readFileSync (node:fs:462:35)
    at Object.load (/vite-vue2-null-repro/node_modules/@vitejs/plugin-vue2/dist/index.cjs:3217:30)
    at file:///vite-vue2-null-repro/node_modules/rollup/dist/es/shared/rollup.js:22748:40

To reproduce

git clone https://github.com/merceyz/vite-vue2-null-repro
cd vite-vue2-null-repro
yarn
yarn vite build

Environment

System:
  OS: Linux 5.10 Ubuntu 22.04.1 LTS 22.04.1 LTS (Jammy Jellyfish)
  CPU: (16) x64 AMD Ryzen 7 3700X 8-Core Processor
Binaries:
  Node: 16.18.0 - /tmp/xfs-46b3435e/node
  Yarn: 3.2.4 - /tmp/xfs-46b3435e/yarn

Extra

This is the same issue as https://github.com/vitejs/vite-plugin-vue2/issues/31

hzuluaga commented 1 year ago

I have the same issue , did you solve it ?

vite build

vite v4.4.4 building for production... ✓ 1207 modules transformed. ✓ built in 6.01s [vite-plugin-vue2] Could not load /Users/humbertozuluaga/Documents/PROYECTOS/adsmovil-dsp/adsmovil-dsp-front/node_modules/vue2-google-maps/dist/components/placeInputImpl.js?vue&type=script&src&from=%2FUsers%2Fhumbertozuluaga%2FDocuments%2FPROYECTOS%2Fadsmovil-dsp%2Fadsmovil-dsp-front%2Fnode_modules%2Fvue2-google-maps%2Fdist%2Fcomponents%2FplaceInput.vue&lang.js?commonjs-exports (imported by node_modules/vue2-google-maps/dist/components/placeInputImpl.js?vue&type=script&src&from=%2FUsers%2Fhumbertozuluaga%2FDocuments%2FPROYECTOS%2Fadsmovil-dsp%2Fadsmovil-dsp-front%2Fnode_modules%2Fvue2-google-maps%2Fdist%2Fcomponents%2FplaceInput.vue&lang.js): The argument 'path' must be a string or Uint8Array without null bytes. Received '\x00/Users/humbertozuluaga/Documents/PROYECTOS/adsmovil-dsp/adsmovil-dsp-front/node_modules/vue2-google-maps/dist/components/pl... error during build: TypeError [ERR_INVALID_ARG_VALUE]: The argument 'path' must be a string or Uint8Array without null bytes. Received '\x00/Users/humbertozuluaga/Documents/PROYECTOS/adsmovil-dsp/adsmovil-dsp-front/node_modules/vue2-google-maps/dist/components/pl... at Object.openSync (fs.js:489:10) at Object.readFileSync (fs.js:393:35) at Object.load (/Users/humbertozuluaga/Documents/PROYECTOS/adsmovil-dsp/adsmovil-dsp-front/node_modules/vite-plugin-vue2/dist/index.js:67:41) at file:///Users/humbertozuluaga/Documents/PROYECTOS/adsmovil-dsp/adsmovil-dsp-front/node_modules/rollup/dist/es/shared/node-entry.js:25336:40 at async PluginDriver.hookFirstAndGetPlugin (file:///Users/humbertozuluaga/Documents/PROYECTOS/adsmovil-dsp/adsmovil-dsp-front/node_modules/rollup/dist/es/shared/node-entry.js:25236:28)

arjen-mediasoep commented 7 months ago

@merceyz @hzuluaga I'm having the same issue. Did one of you solve this?

RyanGst commented 7 months ago

same here EDIT: @arjen-mediasoep @hzuluaga i managed to fix this using patch package and removing place inputs. In my use case, i didn't needed it

prosohail51214 commented 6 months ago

Hi, I fixed this issue by modifying node_modules/vue2-google-maps/components/placeInput.vue file.

All you have to do is just replace

with

aroy314 commented 6 months ago

If this is a working solution, could this be fixed on the packge with a merge request please ? This way we don't have to manually change it after each npm install or update ;) Thanks !