Hi there,
I have a site I created 2 years ago with trellis/bedrock/sage8.x that is running on production.
Now I tried to update everything, using a Linux 16.04 (in DigitalOcean) and updating trellis and bedrock to the current versions. I haven’t updated the sage installation.
I have the deploys running fine but for this problem: runnning ‘gulp --production’ on the server produces sass related problems.
In my local machine, I use nvm to set my node to 0.12.8 and this command runs perfectly (and my dev environment reflects it). Any try to update node to a newest version gets me into a rabbit hole of errors related to the version of gulp-sass, node-sass and more issues that I am not able to overcome.
My current approach is to try to install nvm and have the server run node 0.12 in order to be able to run gulp --production safely.
I have followed the advice of @strarsis on Theme main.css: Cache busting and I came up with:
an .nvmrc file with:
v0.12.8
a build-before file with:
- name: Use specific node version
shell: . $NVM_DIR/nvm.sh && nvm install && nvm use
connection: local
args:
chdir: "{{ project.local_path }}/web/app/themes/sage"
# Paths
- shell: . $NVM_DIR/nvm.sh && dirname $(nvm which | tail -1)
connection: local
args:
chdir: "{{ project.local_path }}/web/app/themes/sage"
register: nvm_which
- name: Clean npm cache
command: npm cache clean --force
connection: local
args:
chdir: "{{ project.local_path }}/web/app/themes/sage"
- name: Clean npm prev install
command: rm -rf node_modules
connection: local
args:
chdir: "{{ project.local_path }}/web/app/themes/sage"
- name: Run npm install
command: npm install
connection: local
args:
chdir: "{{ project.local_path }}/web/app/themes/sage"
- name: Run bower install
command: bower install
connection: local
args:
chdir: "{{ project.local_path }}/web/app/themes/sage"
- name: Run node-sass rebuilding
command: npm rebuild node-sass
connection: local
args:
chdir: "{{ project.local_path }}/web/app/themes/sage"
- name: Run gulp
command: gulp --production
connection: local
args:
chdir: "{{ project.local_path }}/web/app/themes/sage"
- name: Copy project local files
synchronize:
src: "{{ project.local_path }}/web/app/themes/sage/dist"
dest: "{{ deploy_helper.new_release_path }}/web/app/themes/sage"
group: no
owner: no
rsync_opts: --chmod=Du=rwx,--chmod=Dg=rx,--chmod=Do=rx,--chmod=Fu=rw,--chmod=Fg=r,--chmod=Fo=r
However, the gulp --production
command doesn’t work properly, showing some sass-related problems.
I have tried several things to check if the server is actually running nvm and the 0.12 version of node, but I can’t figure it out, as some commands fail and others don’t give me any feedback.
My questions are:
- How do I know the server is actually using node 0.12.8?
- How can I make it use that node version?
Thanks a lot!