# Deploying to Heroku: dependencies of npm packages not getting installed when deploying app

**URL:** https://clojureverse.org/t/deploying-to-heroku-dependencies-of-npm-packages-not-getting-installed-when-deploying-app/4441
**Category:** Troubleshooting
**Tags:** clojure, clojurescript
**Created:** [June 21, 2019, 2:23am UTC](https://clojureverse.org/t/deploying-to-heroku-dependencies-of-npm-packages-not-getting-installed-when-deploying-app/4441 "2019-06-21T02:23:49Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![mamackenzie](https://clojureverse.org/user_avatar/clojureverse.org/mamackenzie/32/2147_2.png) [@mamackenzie](https://clojureverse.org/u/mamackenzie)
#### Post date: [June 21, 2019, 2:23am UTC](https://clojureverse.org/t/deploying-to-heroku-dependencies-of-npm-packages-not-getting-installed-when-deploying-app/4441/1 "2019-06-21T02:23:50Z")

</div>

I am writing a web application with the backend in Clojure and the frontend in Clojurescript with React and Reagent. I am trying to host it on Heroku.

When I run `lein ubjerar` locally, it builds fine and the app works.

However, when I try to deploy the app to Heroku via `git push heroku master`, I always end up with an error like this:

```auto
remote: Preparing npm packages
remote: Installing npm packages
remote: npm packages successfully installed
remote: Running shadow-cljs...
remote: [:app] Compiling ...
remote: The required JS dependency "object-assign" is not available, it was required by "node_modules/react/cjs/react.production.min.js".
remote:
remote: Searched in:/tmp/build_c09494ebe081fa0581db343dc809fb45/node_modules
remote:
remote: You probably need to run:
remote: npm install object-assign
remote:
remote: See: https://shadow-cljs.github.io/docs/UsersGuide.html#npm-install
remote:
remote: ! Failed to build.
remote: ! Push rejected, failed to compile Clojure (Leiningen 2) app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: !	Push rejected to getfluentspanish.
remote:
To https://git.heroku.com/getfluentspanish.git
 ! [remote rejected] master -> master (pre-receive hook declined)

```

This happens in spite of the fact that `object-assign` is listed as a dependency of the `react` npm package, which I already have listed as an item in `:npm-deps` in my `project.clj`. I have verified that when I build locally, the package installs fine (i.e. in this case `node_modules/object-assign` exists).

When I manually add `object-assign` as an explicit dependency in `:npm-deps`, I get the same error, but complaining about a _different_ missing dependency that should get installed automatically (and _does_ locally). When I add the _new_ missing dependency, it complains about another. When I build locally with the new explicit dependencies, `lein uberjar` works but complains that there are now version conflicts because the implicit dependencies are often fixed at a different version.

Any idea how I can fix this?

---

<div class="post-metadata">

### Author: ![jiyinyiyong](https://clojureverse.org/user_avatar/clojureverse.org/jiyinyiyong/32/85_2.png) [@jiyinyiyong](https://clojureverse.org/u/jiyinyiyong)
#### Post date: [June 21, 2019, 2:30am UTC](https://clojureverse.org/t/deploying-to-heroku-dependencies-of-npm-packages-not-getting-installed-when-deploying-app/4441/2 "2019-06-21T02:30:39Z")

</div>

you you have `yarn.lock` or `package-lock.json` in your project? There are used to make sure packages are installed in same same version in every environment.

I’m not familiar with `:npm-deps` though…

---

<div class="post-metadata">

### Author: ![mamackenzie](https://clojureverse.org/user_avatar/clojureverse.org/mamackenzie/32/2147_2.png) [@mamackenzie](https://clojureverse.org/u/mamackenzie)
#### Post date: [June 25, 2019, 8:54pm UTC](https://clojureverse.org/t/deploying-to-heroku-dependencies-of-npm-packages-not-getting-installed-when-deploying-app/4441/3 "2019-06-25T20:54:48Z")

</div>

`:npm-deps` is used by the `lein-shadow` plugin to keep NPM dependencies in the `project.clj` file.

`shadow-cljs` automatically generates the `package.json` and I believe `package-lock.json` is created automatically by NPM on install.

---

<div class="post-metadata">

### Author: ![mamackenzie](https://clojureverse.org/user_avatar/clojureverse.org/mamackenzie/32/2147_2.png) [@mamackenzie](https://clojureverse.org/u/mamackenzie)
#### Post date: [June 25, 2019, 8:57pm UTC](https://clojureverse.org/t/deploying-to-heroku-dependencies-of-npm-packages-not-getting-installed-when-deploying-app/4441/4 "2019-06-25T20:57:09Z")

</div>

I ended up giving up on using Git-based Heroku deployment and instead made a `Dockerfile` and managed to get deploys working that way (using _locally built_ uberjars).

Here’s the wonderfully simple `Dockerfile` I used to make it all work. No other changes were necessary:

```auto
FROM openjdk:8-alpine
COPY target/uberjar/getfluentspanish.jar /getfluentspanish/app.jar
EXPOSE 3000
CMD ["java", "-jar", "/getfluentspanish/app.jar"]

```

I am really glad I learned how to use Docker because it seems like direct PaaS support for Clojure/Clojurescript apps is pretty limited.

Hope this helps someone else with the same problem.

---

<div class="post-metadata">

### Author: ![system](https://clojureverse.org/uploads/default/original/2X/5/51079bf9e4b7d9466242c06cf1e43b9f8bd6da14.png) [@system](https://clojureverse.org/u/system)
#### Post date: [December 25, 2019, 8:57am UTC](https://clojureverse.org/t/deploying-to-heroku-dependencies-of-npm-packages-not-getting-installed-when-deploying-app/4441/5 "2019-12-25T08:57:13Z")

</div>

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.
