anmonteiro / lumo

Fast, cross-platform, standalone ClojureScript environment
Eclipse Public License 1.0
1.88k stars 84 forks source link

Uncaught Error: Undefined nameToPath for hyperapp #421

Open jarcane opened 6 years ago

jarcane commented 6 years ago

Version: 1.8.0, 1.9.0-alpha

$ npm -v
5.6.0

$ pnpm -v
2.14.4

$ node -v
v8.11.4

I'm working on building a Glitch template project for CLJS, and I've got as far as getting CLJS itself to compile fine, but I don't seem to be able to get NPM modules to work.

According to the blogs here and here it seems like I should just be able to :require them but instead I get this:

Uncaught Error: Undefined nameToPath for hyperapp
    at visitNode (base.js:1357)
    at Object.goog.writeScripts_ (base.js:1369)
    at Object.goog.require (base.js:706)
    at (index):24

The WIP project is public so you can see it here: https://glitch.com/edit/#!/wise-feet

Relevant files: build.cljs, package.json, and main.cljs (note: the code in app.main itself possibly doesn't work yet either, but it doesn't get that far as it fails on the require).

I've tried using both node and the :install-deps option to handle the dependencies but I get the same problem regardless.

jarcane commented 6 years ago

I cloned this to Github and tested it locally on my machine, and was able to get it to compile (though that's not the same as working, hyperapp still doesn't seem to mount and render, just no compiler errors happen).

My local Node install is newer though:

cljs-on-glitch master *% = $ node -v
v9.11.1
cljs-on-glitch master *% = $ npm -v
6.2.0

Wondering if this is an issue with the Node/NPM versions, or some specific issue with the Glitch environment.

jarcane commented 6 years ago

on advisement from IRC, I tried a much simpler module, to eliminate as many variables as possible. I can confirm this works offline with the versions above, but not on Glitch's older version: https://glitch.com/edit/#!/curved-prawn

I've cloned this version to Github as well: https://github.com/jarcane/cljs-on-glitch-2

jarcane commented 6 years ago

I've also opened a topic on the Glitch Discourse, as this seems more and more like it's probably specifically related to how Glitch handles npm dependencies. https://support.glitch.com/t/lumo-cljs-and-glitch-pnpm-issue/5283

jarcane commented 6 years ago

OK, I can now reproduce this locally under Ubuntu/WSL. The issue seems to be caused by however pnpm handles modules that differs from normal npm.

The compiler also throws a fun new error to stdio I don't recall seeing on Glitch that further points to a resolver issue:

module.js:549
    throw err;
    ^

Error: Cannot find module 'resolve'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at [eval]:4:19
    at ContextifyScript.Script.runInThisContext (vm.js:50:33)
    at Object.runInThisContext (vm.js:139:38)
    at Object.<anonymous> ([eval]-wrapper:6:22)
    at Module._compile (module.js:652:30)
    at evalScript (bootstrap_node.js:466:27)
hlolli commented 5 years ago

Did you solve this?

jarcane commented 5 years ago

The pnpm folks suggested a workaround that works locally, though we've yet to solve it for Glitch.

The pnpm issue suggests its the result of some of the lumo dependencies:

Seems like some of the subdependencies use modules that are not declared in their package.json

But did not elaborate further.