Roots Discourse

Deployment Error on Install npm dependencies build-before task

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…

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

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.

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:

1 Like

@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: [ -> 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:

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
10% building modules 3/5 modules 2 active …esources/assets/scri
10% building modules 4/5 modules 1 active

10% building
modules 4/6 modules 2 active external
building modules 5/6 modules 1 active

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
10% building modules 6/9 modules 3 active …sources/assets/scrip
10% building modules 6/10 modules 4 active …ources/
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
building modules 9/10 modules 1 active

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

building modules 14/14 modules 0 ac
79% module and chunk tree
80% chunk
81% advanced chunkn
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
92% chunk asset process
94% assetmi `

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

1 Like

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!