SolidJSS
SolidJSโ€ข4y agoโ€ข
4 replies
Michael P. Jung

ts-node not able to resolve ~ or node imports

I've got some scripts written in TypeScript in my project which I would like to execute. After some digging ts-node seams to be the obvious choice. However neither the ~ nor the import from node itself were working. After some digging I found that I can fix the node imports by either removing the types key from the tsconfig compilerOptions altogether or adding node to the array. Regarding the ~ paths however I'm stuck. I tried adding the tsconfig-paths package which doesn't seam to work at all, tried adding imports to the
package.json
and switching to a #root prefix instead.

Nothing seams to help and I'm stuck with the annoying error message:
CustomError: Cannot find package '~' imported from /home/bikeshedder/projects/myproject/src/scripts/gen_schema.ts
Was this page helpful?