NCIOCPL / cgov-digital-platform

The Cancer.gov Digital Communications Platform
GNU General Public License v2.0
11 stars 33 forks source link

There is some issue where we sometimes cannot build the front-end from local Docker #4443

Open bryanpizzillo opened 1 month ago

bryanpizzillo commented 1 month ago

Issue description

This error below started happening recently-ish. A restart of the container fixes it.

npm notice 
npm notice New major version of npm available! 8.19.4 -> 10.8.3
npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.8.3
npm notice Run npm install -g npm@10.8.3 to update!
npm notice 
npm ERR! code 243
npm ERR! path /var/www/docroot/profiles/custom/cgov_site/themes/custom/ncids_trans/front-end/node_modules/@nciocpl/r4r-app
npm ERR! command failed
npm ERR! command sh -c -- npm run build
npm ERR! > @nciocpl/r4r-app@2.0.1 build
npm ERR! > node scripts/build.js
npm ERR! 
npm ERR! Creating an optimized production build...
npm ERR! Compiled successfully.
npm ERR! 
npm ERR! File sizes after gzip:
npm ERR! 
npm ERR!   168.21 KB  build/static/js/main.js
npm ERR!   3.19 KB    build/static/css/main.css
npm ERR! 
npm ERR! The project was built assuming it is hosted at the server root.
npm ERR! You can control this with the homepage field in your package.json.
npm ERR! For example, add this to build it for GitHub Pages:
npm ERR! 
npm ERR!   "homepage" : "http://myname.github.io/myapp",
npm ERR! 
npm ERR! The build folder is ready to be deployed.
npm ERR! You may serve it with a static server:
npm ERR! 
npm ERR!   npm install -g serve
npm ERR!   serve -s build
npm ERR! 
npm ERR! Find out more about deployment here:
npm ERR! 
npm ERR!   http://bit.ly/CRA-deploy
npm ERR! npm WARN logfile Error: EACCES: permission denied, scandir '/root/.npm/_logs'
npm ERR! npm WARN logfile  error cleaning log files [Error: EACCES: permission denied, scandir '/root/.npm/_logs'] {
npm ERR! npm WARN logfile   errno: -13,
npm ERR! npm WARN logfile   code: 'EACCES',
npm ERR! npm WARN logfile   syscall: 'scandir',
npm ERR! npm WARN logfile   path: '/root/.npm/_logs'
npm ERR! npm WARN logfile }
npm ERR! npm ERR! code EACCES
npm ERR! npm ERR! syscall mkdir
npm ERR! npm ERR! path /root/.npm/_cacache/tmp
npm ERR! npm ERR! errno -13
npm ERR! npm ERR! 
npm ERR! npm ERR! Your cache folder contains root-owned files, due to a bug in
npm ERR! npm ERR! previous versions of npm which has since been addressed.
npm ERR! npm ERR! 
npm ERR! npm ERR! To permanently fix this problem, please run:
npm ERR! npm ERR!   sudo chown -R 33:33 "/root/.npm"
npm ERR! 
npm ERR! npm ERR! Log files were not written due to an error writing to the directory: /root/.npm/_logs
npm ERR! npm ERR! You can rerun the command with `--loglevel=verbose` to see the logs in your terminal

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2024-09-13T13_35_40_254Z-debug-0.log
 [ExecStack]  Exit code 243  Time 04:52
 [error]  Executing target-hook frontend-reqs failed.
For troubleshooting guidance and support, see https://docs.acquia.com/blt/support/ 
The command failed. This often indicates a problem with your configuration. Review the command output above for more detailed errors, and consider re-running with verbose output for more information.
 [error]  Command `source:build:frontend-reqs ` exited with code 1.
For troubleshooting guidance and support, see https://docs.acquia.com/blt/support/ 
The command failed. This often indicates a problem with your configuration. Review the command output above for more detailed errors, and consider re-running with verbose output for more information.
 [error]  Command `source:build:frontend ` exited with code 1.
For troubleshooting guidance and support, see https://docs.acquia.com/blt/support/ 
bryanpizzillo commented 1 month ago

Removing r4r gets the error faster, but it still happens.

root@8a855308b6b6:/var/www/docroot/profiles/custom/cgov_site/themes/custom/ncids
_trans/front-end# npm WARN logfile Error: EACCES: permission denied, scandir '/root/.npm/_logs'
npm WARN logfile  error cleaning log files [Error: EACCES: permission denied, scandir '/root/.npm/_logs'] {
npm WARN logfile   errno: -13,
npm WARN logfile   code: 'EACCES',
npm WARN logfile   syscall: 'scandir',
npm WARN logfile   path: '/root/.npm/_logs'
npm WARN logfile }

> ncids_trans@1.0.0 clean:legacy-sprite
> rimraf ./build && rimraf ./src/styles/legacy-sprites/_svg-sprite-map.scss

npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /root/.npm/_cacache/tmp
npm ERR! errno -13
npm ERR! 
npm ERR! Your cache folder contains root-owned files, due to a bug in
npm ERR! previous versions of npm which has since been addressed.
npm ERR! 
npm ERR! To permanently fix this problem, please run:
npm ERR!   sudo chown -R 33:33 "/root/.npm"

npm ERR! Log files were not written due to an error writing to the directory: /root/.npm/_logs
npm ERR! You can rerun the command with `--loglevel=verbose` to see the logs in your terminal