Hi Dan, Radda,
This is a follow-on to my earlier message about getting started with the new BS5 Dominion theme. A few weeks back when I first started testing the GitHub method, I installed NodeJS 19.x (latest version) and didn't have any problems running the prerequisite npm commands mentioned by Radda. Then I looked at
the NodeJS release schedule and concluded that it'd be best to
install NodeJS 18.x LTS, as it's LTS with support until 2025-04-30. Non-LTS NodeJS 19.x is fine in testing, but later down the line, in production environments, my thinking is that it would be best to avoid short-term releases.
So I've been doing further testing with the stable/2.7.x branch, NodeJS 18.x LTS, and running the npm commands. I installed 18.x successfully but noticed that after running 'npm install' I would see a 'Cypress cannot write to the cache directory due to file permissions' error (†), even when running as root. I believe this is something to do with npm determining the ownership of /usr/share/nginx/atom and then attempting to run as the directory owner (www-data) which doesn't then have access to /root/.cache/Cypress.
Anyway, I have concocted a workaround, which is to pass the HOME and CYPRESS_CACHE_FOLDER variables directly to npm:
cd /usr/share/nginx/atom
HOME="$(echo ~www-data)" CYPRESS_CACHE_FOLDER="cypress_cache" npm install
# Fix 'sh: 1: webpack: Permission denied'
chmod +x /usr/share/nginx/atom/node_modules/webpack/bin/webpack.js
HOME="$(echo ~www-data)" CYPRESS_CACHE_FOLDER="cypress_cache" npm run build
rm -rf node_modules
An aside - there is another small fix in there to set executable permissions on webpack.js
† Full error lines below:
root@ubuntu-focal:/usr/share/nginx/atom#npm install
npm ERR! code 1
npm ERR! path /usr/share/nginx/atom/node_modules/cypress
npm ERR! command failed
npm ERR! command sh -c -- node index.js --exec install
npm ERR! Cypress cannot write to the cache directory due to file permissions
npm ERR!
npm ERR! See discussion and possible solutions at
npm ERR! https://github.com/cypress-io/cypress/issues/1281
npm ERR!
npm ERR! ----------
npm ERR!
npm ERR! Failed to access /root/.cache/Cypress:
npm ERR!
npm ERR! EACCES: permission denied, mkdir '/root/.cache/Cypress'
npm ERR!
npm ERR! ----------
npm ERR!
npm ERR! Platform: linux-x64 (Ubuntu - 20.04)
npm ERR! Cypress Version: 10.3.0
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2023-01-11T12_10_44_909Z-debug-0.log
Just thought I'd mention this, as others testing the BS5 theme may well hit the same problem.
When I tested the Ubuntu supplied version of npm, I saw the following warning/errors:
root@ubuntu-focal:/usr/share/nginx/atom#npm install
npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!
npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for fsev...@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! notsup Valid OS: darwin
npm ERR! notsup Valid Arch: any
npm ERR! notsup Actual OS: linux
npm ERR! notsup Actual Arch: x64
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2023-01-18T16_17_02_551Z-debug.log
I hope my findings are useful!
Thanks, Jim