codemirror / lang-example

Example/template repository for building a language package
MIT License
69 stars 43 forks source link

TypeError: path.charCodeAt is not a function #9

Closed arnoson closed 2 years ago

arnoson commented 2 years ago

When trying to build the language example I get the following error:

[!] (plugin Typescript) TypeError: path.charCodeAt is not a function
src/index.ts
TypeError: path.charCodeAt is not a function
    at getEncodedRootLength (/home/arno/development/lang-example/node_modules/typescript/lib/typescript.js:7660:24)
    at Object.isRootedDiskPath (/home/arno/development/lang-example/node_modules/typescript/lib/typescript.js:7567:16)
    at Object.isExternalModuleNameRelative (/home/arno/development/lang-example/node_modules/typescript/lib/typescript.js:12360:52)
    at tryLoadModuleUsingOptionalResolutionSettings (/home/arno/development/lang-example/node_modules/typescript/lib/typescript.js:43172:17)
    at tryResolve (/home/arno/development/lang-example/node_modules/typescript/lib/typescript.js:43375:28)
    at /home/arno/development/lang-example/node_modules/typescript/lib/typescript.js:43371:69
    at Object.forEach (/home/arno/development/lang-example/node_modules/typescript/lib/typescript.js:377:30)
    at nodeModuleNameResolverWorker (/home/arno/development/lang-example/node_modules/typescript/lib/typescript.js:43371:25)
    at nodeModuleNameResolver (/home/arno/development/lang-example/node_modules/typescript/lib/typescript.js:43346:16)
    at Object.resolveModuleName (/home/arno/development/lang-example/node_modules/typescript/lib/typescript.js:43073:30)
marijnh commented 2 years ago

Does this happen after you run npm install in a fresh clone of this repository?

arnoson commented 2 years ago

Yes, happens right after npm install on a fresh clone or after runing rollup -c manually. My node version is v16.15.0 and I'm running it on WSL2

marijnh commented 2 years ago

Odd. On my system (Linux, node 16, npm 8) I can install and build without issue.

arnoson commented 2 years ago

Okay this is really odd indeed, I switched to rollup-plugin-esbuild and everything works again

isaiahdahl commented 2 years ago

I'm also getting this issue. Mac, node 18, yarn 1.22.17

Edit: figured it out with rollup-plugin-esbuild as well

corwin-of-amber commented 2 years ago

I think the dependency rollup-plugin-ts has to be updated. After running npm i rollup-plugin-ts@latest (currently 3.0.2) I am no longer seeing this error.

Enchiridion commented 2 years ago

@corwin-of-amber Thanks for that tip! I was getting the exact same issue (Win 10, node 16, npm 8). I'm not familiar with rollup (webpack user here) so that saved me a ton of time.

StoneCypher commented 2 years ago

Windows 10, node 18.4.0, npm 7.2.0, also saved by @corwin-of-amber 's observation

Submitting a patch to fix