Open kulttuuri opened 2 months ago
And it will also cause an error about javascript modules. Need to also do this fix, also:
https://coderunner.org.nz/mod/forum/discuss.php?d=707
File: /var/www/html/jobe/application/libraries/nodejs_task.php
Edit:
Original functions:
public function compile() { $this->executableFileName = $this->sourceFileName; if (strpos('.js', $this->executableFileName) != strlen($this->executableFileName) - 3) { $this->executableFileName .= '.js'; } if (!copy($this->sourceFileName, $this->executableFileName)) { throw new exception("Node_Task: couldn't copy source file"); } }
public function getTargetFile() { return $this->sourceFileName; }
And edited functions to make the runnable script be saved as .mjs:
public function compile() { $this->executableFileName = preg_replace('/.js$/', '.mjs', $this->sourceFileName); if (!copy($this->sourceFileName, $this->executableFileName)) { throw new exception("Node_Task: couldn't copy source file"); } }
public function getTargetFile() { return preg_replace('/.js$/', '.mjs', $this->sourceFileName); }
These commands can be used to update nodejs to a later version, add these to the Dockerfile: