Fork me on GitHub
#shadow-cljs
<
2021-01-01
>
Dan Maltbie21:01:47

I'm working with a package that has an alternate way to install for its "nightly" build. I've cloned the package repo to my local drive and built the package (actually it builds multiple packages but in my example I'm only using one.) The local repo serves up the package via a http interface using a simple Python server. I can then install the package using npm install with the dependency in my project package.json file of  `"@ndn/packet": "http://localhost:8000/packet.tgz"`. The package installs properly but fails when I run shadow-cljs to compile. I have tested using this package with webpack and node.js so I am confident that the Javascript stuff is working properly. Is there something I need to do with shadow-cljs to get this to work? The compile fails with the following error: (parallels) (27)# shadow-cljs compile app shadow-cljs - config: /media/psf/DataPartition/lastmile/ttncore/shadow-cljs.edn [:app] Compiling ... npm package "@ndn/packet" expected version "@ndn/tlv@http://localhost:8000/tlv.tgz" but "0.0.20201213-nightly-eb9e062" is installed. [:app] Build completed. (225 files, 6 compiled, 0 warnings, 11.57s) npm ls reports the following: (parallels) (28)# npm ls | more [email protected] /media/psf/DataPartition/lastmile/ttncore ├─┬ @babel/[email protected] │ └── [email protected] ├─┬ @ndn/[email protected] │ ├─┬ @ndn/[email protected] And here's a snippet from my package.json file: "dependencies": { "@babel/runtime": "^7.12.5", "@ndn/packet": "",

thheller23:01:12

@dmaltbie [:app] Build completed. (225 files, 6 compiled, 0 warnings, 11.57s) the build succeeded? the "expected version" thing is just a warning?

Dan Maltbie00:01:55

It appears so. And the code seems to work. Should I ignore these warnings? I don't get them when I compile with webpack or node.

thheller01:01:10

you seem to have a deps.cljs which you don't really need?

Dan Maltbie01:01:38

I'm not seeing that. Where would that be specified (which file)?

Dan Maltbie01:01:13

I can't find a file in the project named deps.cljs. my shadow-cljs.edn file contains two cljsjs packages. could that cause a problem? :dependencies [ [cljsjs/hash "1.1.3-0"] [cljsjs/msgpack-lite "0.1.26-0"] [reagent "1.0.0-alpha2"] [reagent-utils "0.3.3"] ]

thheller01:01:20

you don't need to include those cljsjs deps since shadow-cljs will not use them anyways

thheller01:01:26

don't know what they would provide

thheller01:01:29

you can set :npm-deps {:install false}. then it won't warn or attempt to install npm dependencies from deps.cljs. something in your dependencies or you project has a deps.cljs file which declares a :npm-deps dependency on "@ndn/packet" with version "@ndn/tlv@http://localhost:8000/tlv.tgz"

Dan Maltbie01:01:20

The package.json file for @ndn/packet (in the node_modules directory) has a dependency for the tlv.tgz file. But there isn't a deps.cljs file. And I thought I needed to have the package version specified in the shadow-cljs.edn file for packages I use. Are you saying that I should just install with npm instead of cljsjs?

Dan Maltbie01:01:42

Where does the :npm-deps statement go?

Dan Maltbie01:01:29

Ok. I see in the User Guide section 5.2.2 that it says to use npm to manage the JS packages and not cljsjs. got it. But I still can't find where to put the :npm-deps statement. Do I put it in my main.cljs file or create a deps.cljs file?

thheller10:01:27

into shadow-cljs.edn at the top level

thheller10:01:03

you must have a deps.cljs files somewhere. its the only file that causes those warnings. it might be in one of the cljsjs dependencies though so if the warning goes away after removing them its probably one of those

Dan Maltbie19:01:04

I expect this is my bonehead problem, but I can't get the :npm-deps option to work. I've tried several ways with no success. I even tried it in a deps.cljs file in the src directory. Can you please look at my shadow-cljs.edn file and tell me what I'm doing wrong? You'll see I've tried it in various places in the .edn file just to see if I misplaced it. No luck. Also, I've searched for the deps.cljs file but I'm not finding one. (used find starting from root and grep to search the source tree). Thanks.

thheller20:01:26

at the top level the one is just fine. are you maybe on an old version that doesn't have this flag?

Dan Maltbie23:01:34

Here's what I've got:

(parallels) (157)# shadow-cljs info
shadow-cljs - config: /media/psf/DataPartition/lastmile/ttncore/shadow-cljs.edn
=== Version
jar:            2.11.11
cli:            2.11.11
deps:           1.3.2
config-version: 2.11.11

=== Java
openjdk version "11.0.9.1" 2020-11-04
OpenJDK Runtime Environment (build 11.0.9.1+1-Ubuntu-0ubuntu1.20.04)
OpenJDK 64-Bit Server VM (build 11.0.9.1+1-Ubuntu-0ubuntu1.20.04, mixed mode, sharing)

Dan Maltbie23:01:36

Also in my package.json I have (is this necessary?):

"devDependencies": {
        "onchange": "^7.1.0",
        "shadow-cljs": "^2.11.11",
        "tailwindcss": "^1.9.6"
    },

thheller00:01:35

looks fine to me. I don't know what is up with your setup but again you can ignore the warning. it has no impact on the build whatsoever.

Dan Maltbie02:01:32

Ok. Thanks for your help.

Dan Maltbie23:01:54

Just curious, is there is a way to examine the option settings for a given runtime of the compiler?

thheller10:01:33

not sure I understand the question? which "runtime" are you talking about abnd which settings?

thheller13:01:01

hey, I just released version 2.11.12 which should get rid of the warning you asked about. it doesn't compare versions using http: etc anymore

thheller13:01:24

in addition there is a :js-options {:check-versions false} to turn the check off completely (true by default)

Dan Maltbie18:01:41

That worked for me!! Thanks. I really appreciate being able to weed out the extraneous warnings so that I can see any others with less clutter. Big Thumbs Up!