node-csv
node-csv copied to clipboard
Build fails in CI "Property 'on' does not exist on type 'Parser'"
Describe the bug
When using the csv library for a frontend app with Vue, I get build errors on multiple CI environments. When running the build command locally, it's working fine. In all CI environments I tried (Github Actions, Azure Pipelines, Cloudflare Pages), I get an error when runnung npm run build
src/services/my-parser.ts(61,16): error TS2339: Property 'on' does not exist on type 'Parser'.
src/services/my-parser.ts(63,37): error TS2339: Property 'read' does not exist on type 'Parser'.
src/services/my-parser.ts(68,16): error TS2339: Property 'on' does not exist on type 'Parser'.
src/services/my-parser.ts(73,16): error TS2339: Property 'on' does not exist on type 'Parser'.
To Reproduce
I made a Vue Project with Vite as build system using pnpm create vite my-vue-app --template vue-ts. I tried using '[email protected]' as well as ' [email protected]'.
I use import according to docs from csv-parse/browser/esm and then use the parse() and parser.on() as well as parser.read()
Additional context
Locally, the build works regardless. I tried using pnpm as well as npm without success
Sorry but unless you provide me a script replicating the issue, it will be hard for us to investigate.
Sorry, I was in a hurry. I now created a sample repo as described https://github.com/aryobenholzner/vue-csv. Notice the github action fails when running npm run build
any updates on this? i would really like to use this package in client
Nope, I don't have much time lately. Moreover, this is a TS compilation error, and I am no expert in that matter.
@aryobenholzner Parser extends stream.Transform from Node, the on method comes from stream.Transform.
By default, these Node types are missing.
To add the missing Node types, simply install the @types/node package.
npm install -D @types/node
It might make sense to add @types/node into the dev dependencies of this library but I don't know whether it is a best practice.