Installation

Upgrade to 2.17 not rendering web pages correctly

Upgrade to 2.17 not rendering web pages correctly

by Tim Alderson -
Number of replies: 2

I am at a loss here. I upgraded to 2.17 from 2.16 (Ubuntu 20.04).  I thought I was installing hot-fixes but inadvertently upgraded to 2.17 on a production server...But I digress. 

With 2.16, tikz worked fine and all rendered well. However, now the web pages are not rendering correctly at all and throwing a tikz error (see below), and students are not able to complete their work.  

The server that I upgraded looks like this: https://webwork.unbsj.ca/webwork2

I followed the upgrade instructions in the release notes, all seemed to go well except for errors when running npm install in htdocs.


npm install (in htdocs) errors:

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 }

> generate-assets
> node generate-assets

npm verb stack Error: EACCES: permission denied, mkdir '/root/.npm/_cacache/tmp'
npm verb cwd /opt/webwork/webwork2/htdocs
npm verb Linux 5.15.0-43-generic
npm verb node v16.16.0
npm verb npm  v8.16.0
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /root/.npm/_cacache/tmp
npm ERR! errno -13
npm verb Error: EACCES: permission denied, mkdir '/root/.npm/_cacache/tmp'
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 1000:1000 "/root/.npm"
npm verb exit -13
npm timing npm Completed in 254ms
npm verb unfinished npm timer command:run 1660002672320
npm verb code -13

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
npm timing command:install Completed in 1095ms
npm verb stack Error: command failed
npm verb stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/lib/index.js:63:27)
npm verb stack     at ChildProcess.emit (node:events:527:28)
npm verb stack     at maybeClose (node:internal/child_process:1092:16)
npm verb stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
npm verb cwd /opt/webwork/webwork2/htdocs
npm verb Linux 5.15.0-43-generic
npm verb node v16.16.0
npm verb npm  v8.16.0
npm ERR! code 243
npm ERR! path /opt/webwork/webwork2/htdocs
npm ERR! command failed
npm ERR! command sh /tmp/prepare-9740eea2.sh
npm verb exit 243
npm timing npm Completed in 1209ms
npm verb code 243

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2022-08-08T23_51_11_334Z-debug-0.log
wwadmin@webwork:/opt/webwork/webwork2/htdocs$ node:internal/fs/utils:345
    throw err;
    ^

Error: EACCES: permission denied, open '/opt/webwork/webwork2/htdocs/themes/math4-yellow/math4-overrides.js'
    at Object.openSync (node:fs:585:3)
    at Object.<anonymous> (/opt/webwork/webwork2/htdocs/generate-assets.js:210:19)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
    at node:internal/main/run_main_module:17:47 {
  errno: -13,
  syscall: 'open',
  code: 'EACCES',
  path: '/opt/webwork/webwork2/htdocs/themes/math4-yellow/math4-overrides.js'

From the NPM log file:

61 verbose stack Error: ENOENT: no such file or directory, open '/opt/webwork/webwork2/bin/package.json'
62 verbose cwd /opt/webwork/webwork2/bin
63 verbose Linux 5.15.0-43-generic
64 verbose node v16.16.0
65 verbose npm  v8.11.0
66 error code ENOENT
67 error syscall open
68 error path /opt/webwork/webwork2/bin/package.json
69 error errno -2
70 error enoent ENOENT: no such file or directory, open '/opt/webwork/webwork2/bin/package.json'
71 error enoent This is related to npm not being able to find a file.
71 error enoent
72 verbose exit -2
73 timing npm Completed in 153ms
74 verbose code -2
75 error A complete log of this run can be found in:
75 error     /home/wwadmin/.npm/_logs/2022-08-08T23_08_18_530Z-debug-0.log

Homework set Problem Errors:

Warning messages

Failed to evaluate module TikZImage: Can't locate TikZImage.pm in @INC (you may need to install the TikZImage module) (@INC contains: /opt/webwork/pg/lib /opt/webwork/webwork2/lib /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.30.0 /usr/local/share/perl/5.30.0 /usr/lib/x86_64-linux-gnu/perl5/5.30 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.30 /usr/share/perl/5.30 /usr/local/lib/site_perl /etc/apache2) at (eval 885) line 1.ERROR: '/opt/webwork/webwork2/htdocs/static-assets.json' not found!You may need to run 'npm install' from '/opt/webwork/webwork2/htdocs'. at /opt/webwork/webwork2/lib/WeBWorK/Utils.pm line 1875.


Landing page errors:

Warning messages

  • ERROR: '/opt/webwork/webwork2/htdocs/static-assets.json' not found!
  • You may need to run 'npm install' from '/opt/webwork/webwork2/htdocs'. at /opt/webwork/webwork2/lib/WeBWorK/Utils.pm line 1875.
Page generated at 08/08/2022 at 09:09pm ADT
WeBWorK © 1996-2022 | theme: math4 | ww_version: 2.17 | pg_version 2.17 | The WeBWorK Project

In reply to Tim Alderson

Re: Upgrade to 2.17 not rendering web pages correctly

by Larry Riddle -
I am also trying to upgrade to 2.17, and like Tim,
"I followed the upgrade instructions in the release notes, all seemed to go well except for errors when running npm install in htdocs"

When trying to login to WeBWorK, I am also getting the same warning messages. In my case, when I try to run 'npm install' from webwork2/htdocs, I get the error messages

npm ERR! code EACCES
npm ERR! syscall open
npm ERR! path /opt/webwork/webwork2/htdocs/package-lock.json
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, open '/opt/webwork/webwork2/htdocs/package-lock.json'
npm ERR! [Error: EACCES: permission denied, open '/opt/webwork/webwork2/htdocs/package-lock.json'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'open',
npm ERR! path: '/opt/webwork/webwork2/htdocs/package-lock.json'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

If I then try to run the command again using 'sudo npm install', I get the error messages
> prepare
> npm run generate-assets
npm ERR! code 243
npm ERR! path /opt/webwork/webwork2/htdocs
npm ERR! command failed
npm ERR! command sh -c npm run generate-assets

These seem to be different errors than what Tim is seeing.

The other issue I'm seeing is that the pages in browser are not displayed correctly as if the css information is not being used.
In reply to Tim Alderson

Re: Upgrade to 2.17 not rendering web pages correctly

by Danny Glin -

I think the solution to your issue is buried in the middle of that output:

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 1000:1000 "/root/.npm"

After running that chown command, try running npm install again.