Fork me on GitHub
#shadow-cljs
<
2018-01-16
>
mjmeintjes10:01:25

Hi. I'm trying to use shadow-cljs along with Macchiato. However, I'm getting the following error when running the file produced by shadow-cljs -

SHADOW import error /projects/funnels-cljs/target/shadow-cljs/builds/server/dev/out/cljs-runtime/macchiato.crypto.js
/projects/funnels-cljs/node_modules/source-map/lib/source-map-consumer.js:539
      throw new TypeError('Line must be greater than or equal to 1, got '
      ^

TypeError: Line must be greater than or equal to 1, got null
I'm not sure if I'm doing anything wrong, because I have very limited experience with nodejs.

thheller11:01:36

can you paste the full error?

thheller11:01:44

that looks like it has trouble using the source map

thheller11:01:51

that is not the actual error

mjmeintjes11:01:34

$ /projects/funnels-cljs$ node out/funnels-cljs/server.js

SHADOW import error /projects/funnels-cljs/target/shadow-cljs/builds/server/dev/out/cljs-runtime/macchiato.crypto.js
/projects/funnels-cljs/node_modules/source-map/lib/source-map-consumer.js:539
      throw new TypeError('Line must be greater than or equal to 1, got '
      ^

TypeError: Line must be greater than or equal to 1, got null
    at BasicSourceMapConsumer.SourceMapConsumer_findMapping [as _findMapping] (/projects/funnels-cljs/node_modules/source-map/lib/source-map-consumer.js:539:13)
    at BasicSourceMapConsumer.SourceMapConsumer_originalPositionFor [as originalPositionFor] (/projects/funnels-cljs/node_modules/source-map/lib/source-map-consumer.js:604:22)
    at mapSourcePosition (/projects/funnels-cljs/node_modules/source-map-support/source-map-support.js:199:42)
    at wrapCallSite (/projects/funnels-cljs/node_modules/source-map-support/source-map-support.js:343:20)
    at /projects/funnels-cljs/node_modules/source-map-support/source-map-support.js:378:26
    at Array.map (<anonymous>)
    at Function.prepareStackTrace (/projects/funnels-cljs/node_modules/source-map-support/source-map-support.js:377:24)
    at process.emit (/projects/funnels-cljs/node_modules/source-map-support/source-map-support.js:431:52)
    at process._fatalException (bootstrap_node.js:386:26)

thheller11:01:55

hmm that completely replaced the actual error

mjmeintjes11:01:56

This is basically just from taking the Macchiato lein project template, and then adding a shadow-cljs.edn file and trying to run it that way.

thheller11:01:30

can you share the repo so I can take a closer look?

mjmeintjes11:01:01

Will do, give me a few minutes.

thheller11:01:03

I usually already remove the lineCount property from source maps, looks like I forgot to do that somewhere

thheller11:01:46

/projects/funnels-cljs/target/shadow-cljs/builds/server/dev/out/cljs-runtime/macchiato.crypto.js.map probably has "lineCount":null which it shouldn’t

thheller11:01:42

hmm not about lineCount. odd.

thheller11:01:48

the actual error is Error: Cannot find module 'simple-encryptor'

thheller11:01:18

and Cannot find module 'multiparty'

thheller11:01:29

and Cannot find module 'cookies'

thheller11:01:53

you can set :compiler-options {:source-map false} in the build config

thheller11:01:07

so you’ll get all the errors yourself instead of me pasting them here

thheller11:01:18

its basically just a bunch of missing npm packages

thheller11:01:31

no idea why the source map is broken though. looking into that now.

mjmeintjes11:01:46

Thanks, appreciate the help!

mjmeintjes11:01:43

It is working now, was just a few missing npm dependencies.

thheller12:01:26

there isn’t a single null in the source map. I don’t get it 😛

thheller12:01:34

gah .. the source-map-support package for node is just one piece of horrible ugly code

thheller15:01:01

@mjmeintjes should be safe to enable source maps with [email protected] again, was using incorrect offsets so source maps got confused.