Katex: cli doesn't run after yarn global install

Created on 18 Mar 2018  路  4Comments  路  Source: KaTeX/KaTeX

After

yarn global add khan/katex

I get:

Error: Cannot find module './'
    at Function.Module._resolveFilename (module.js:555:15)
    at Function.Module._load (module.js:482:25)
    at Module.require (module.js:604:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/shauncutts/.config/yarn/global/node_modules/katex/cli.js:6:15)
    at Module._compile (module.js:660:30)
    at Object.Module._extensions..js (module.js:671:10)
    at Module.load (module.js:573:32)
    at tryModuleLoad (module.js:513:12)
    at Function.Module._load (module.js:505:3)

which is unsurprising as there is no "index.js" in the package root (?)

bug cli

All 4 comments

Good call. cli.js should probably be updated to include "./dist/katex.js" instead of "./". We should probably have some tests for cli.js as well.

I figured out part of the problem: yarn global add khan/katex makes a yarn/global/node_modules/katex directory without dist. This causes the ./ -> dist/katex.js pointer (specified by property main in package.json) fail.

But I can't figure out why yarn would differ from npm in this way. Anyone have ideas?

khan/katex resolves to this GitHub repository and clones the master branch, which doesn't contain built files. (https://github.com/Khan/KaTeX/issues/894#issuecomment-404758297) You should grab release version from npm, i.e., yarn global add katex. (If you'd like to use development version, see previous comment and CONTRIBUTING.md for how to build the project.)

Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

trollanfer picture trollanfer  路  5Comments

Joe312341 picture Joe312341  路  5Comments

jason-s picture jason-s  路  3Comments

mbourne picture mbourne  路  3Comments

mpolyak picture mpolyak  路  3Comments