# Deployment Error on Install npm dependencies build-before task

**URL:** https://discourse.roots.io/t/deployment-error-on-install-npm-dependencies-build-before-task/16936
**Category:** trellis
**Tags:** sage9
**Created:** 2019-10-30T17:22:22Z
**Posts:** 8

## Post 1 by @mpuk — 2019-10-30T17:22:22Z

I’m getting a really long and unclear error (that appears to be a dependency installation error) that triggers on the `TASK [deploy : Install npm dependencies]` task.

Here’s a sample of what i’m seeing…

 ![04%20AM](https://discourse.roots.io/uploads/default/original/2X/a/aa876901c4c6b49409d270ed6be9e4fd4f76183b.png)

Is there an way to deploy in debug mode to get some clarity on what the issue might be?

---

## Post 2 by @mpuk — 2019-10-30T17:32:50Z

fwiw… I did try the deploy task with `-v` afterwards, but given the length of the messaging above, it didn’t give me anything new.

---

## Post 3 by @alwaysblank — 2019-10-30T17:36:22Z

My guess is that it’s having trouble installing node-sass. You might try switching to the Dart Sass version, which has way fewer install issues IME and is the “official” sass package going forward IIRC. Instructions are here:

> <https://github.com/webpack-contrib/sass-loader/blob/master/README.md#implementation>

---

## Post 4 by @mpuk — 2019-10-30T17:59:35Z

@alwaysblank Thanks for the quick reply! Tried it, but same result. It did error out a little more quickly, and got somewhat of a clearer message related to _yarn_:

`error Command failed with exit code 2. fatal: [165.227.251.12 -> localhost]: FAILED! => {"changed": true, "cmd": ["yarn", "build:production"], "delta": "0:00:02.671758", "end": "2019-10-30 11:49:59.083029", "rc": 2, "start": "2019-10-30 11:49:56.411271", "stderr_lines": [" 0% compiling\b\b\b\b\b\b\b\b\b\b\b\b\b\b 10% building modules 0/1 modules 1 active ... ./scripts/main.js ./styles/main.scss\b \b\b \b\b \b\b \b\b \b\b \b\b \b\b \b\b \b\b \b\b \b\b \b\b \b\b \b\b \b\b \b\b \b\b \b\b \b\b \b\b \b\b \b\b \b\b \b\b \b\b........`

I was getting a similar error with Yarn hanging on my local build, and the solution was to install a version of Node 8 (where I was on Node 12) with NVM to have the yarn task complete. Would the two have some relation? You’d think so, but i’m seeing that Node 8.x comes with the DO Droplet i’m deploying to: [https://marketplace.digitalocean.com/apps/nodejs](https://marketplace.digitalocean.com/apps/nodejs)

---

## Post 5 by @mpuk — 2019-10-30T18:28:28Z

I downgraded Node to match the version installed with **Ubuntu** in my Droplet. @alwaysblank it does look like the NPM and Composer tasks now completed without error, and the _yarn_ error is coming from the Compile Assets for Production Task. Here’s what i’m seeing before the error above:

## `TASK [deploy : Compile assets for production] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* System info: Ansible 2.7.5; Darwin Trellis version (per changelog): “Fix issues with Vagrant ansible\_local provisioner”

non-zero return code  
10% building modules 0/1 modules 1 active …  
./scripts/main.js ./sty

10% building modules 1/1  
10% buildingive  
modules 1/2 modules 1 active multi ./scripts/customi

10% building modules 2/2 modules  
10% building modules 2/3  
modules 1 active …oint/resources/assets/scripts/main.js  
10% building  
modules 2/4 modules 2 active …esources/assets/scripts/customizer.js

10% building modules 2/5 modules 3 active …int/resources/assets/styles/main  
.scss  
10% building modules 3/5 modules 2 active …esources/assets/scri  
pts/customizer.js  
10% building modules 4/5 modules 1 active  
…oint/resources/assets/scr

10% building  
modules 4/6 modules 2 active external  
10%ery"  
building modules 5/6 modules 1 active  
…oint/resources/assets/scr

10% building modules 6/6  
10% buildingive  
modules 6/7 modules 1 active …sources/assets/scripts/util/Router.js

10% building modules 6/8 modules 2 active …urces/assets/scripts/routes/comm  
on.js  
10% building modules 6/9 modules 3 active …sources/assets/scrip  
ts/routes/home.js  
10% building modules 6/10 modules 4 active …ources/  
assets/scripts/routes/about.js  
10% building modules 7/10 modules 3  
active …ources/assets/scripts/routes/about.js  
10% building modules  
8/10 modules 2 active …ources/assets/scripts/routes/about.js  
11%  
building modules 9/10 modules 1 active  
…urces/assets/scripts/rout

11% building modules 10/10  
11% buildingive  
modules 10/11 modules 1 active …rces/assets/scripts/util/camelCase.j

11% building modules 11/11  
11% buildingive  
modules 11/12 modules 1 active …llapoint/node\_modules/aos/dist/aos.j

11% building modules 12/12  
11% buildingive  
modules 12/13 modules 1 active …ode\_modules/webpack/buildin/global.j

11% building modules 13/13

72% sealing  
73% basic module optimiz  
75% module optimization  
76%nced module optimiza  
77% chunkk optimi  
78% advanced chunk  
11% building modules 13/14  
modules 1 active …int/resources/assets/styles/mai

11%  
building modules 14/14 modules 0 ac  
79% module and chunk tree  
80% chunk  
81% advanced chunkn  
mo  
83% module reviving  
84% module idt  
85% chunk  
86% chunk order optimizati  
87% chunk id optim  
89% module assets  
90% chunk assets  
91% additional chunk assets  
91%  
92% chunk asset process  
94% assetmi `

---

## Post 6 by @alwaysblank — 2019-10-30T18:59:34Z

iirc the `build-before` tasks run locally, not on the server. What happens if you manually run `yarn build:production` locally?

---

## Post 7 by @mpuk — 2019-10-30T19:37:45Z

Ah! Didn’t know that. `yarn build:production` is failing now too that I swapped dart-sass with node-sass. I replaced node-sass, wiped out node\_modules and the lock files and re-ran `yarn` and `yarn build:production` and everything built. Tried the deployment, and that worked now too! Go figure.

Thanks for your help!

---

## Post 8 by @system — 2019-12-11T17:30:30Z

This topic was automatically closed after 42 days. New replies are no longer allowed.
