eldargab / easy-table

Nice text table for Node.js
314 stars 31 forks source link

error TS2307: Cannot find module 'easy-table' #14

Closed ngmariusz closed 7 years ago

ngmariusz commented 7 years ago

PROBLEM

======== Resolving module 'easy-table' from '/opt/..../lib/modules/Commands/all/git-yaml/myaction.ts'. ========
Explicitly specified module resolution kind: 'NodeJs'.
Loading module 'easy-table' from 'node_modules' folder, target file type 'TypeScript'.
Directory '/opt/..../lib/modules/Commands/all/git-yaml/node_modules' does not exist, skipping all lookups in it.
Directory '/opt/..../lib/modules/Commands/all/node_modules' does not exist, skipping all lookups in it.
Directory '/opt/..../lib/modules/Commands/node_modules' does not exist, skipping all lookups in it.
Directory '/opt/..../lib/modules/node_modules' does not exist, skipping all lookups in it.
Directory '/opt/..../lib/node_modules' does not exist, skipping all lookups in it.
File '/opt/..../node_modules/easy-table.ts' does not exist.
File '/opt/..../node_modules/easy-table.tsx' does not exist.
File '/opt/..../node_modules/easy-table.d.ts' does not exist.
Found 'package.json' at '/opt/..../node_modules/easy-table/package.json'.
'package.json' does not have a 'types' or 'main' field.

SOLUTION

please change

// package.json

from
"main": ./lib/table

to
"main": ./lib/table.js
eldargab commented 7 years ago

We can do this for sure, but the problem is really with build tool you are using. Omitting .js extension in the main field is/was a standard node practice. It should be better to fix the build tool and make it compatible with perhaps many other modules. I suggest to report issue there.

eldargab commented 7 years ago

Changed package.main to ./table.js in a new version