SyntaxError: Named export 'format' not found. The requested module 'json-rpc-peer' is a CommonJS module
-
Just tried updating my latest XO community version to the latest but ran into this issue when starting.
node version is 14.16.1
npm version is 6.14.12
yarn version is 1.22.4Any ideas as to what this problem is?
May 25 12:56:32 server-xo systemd[1]: Started XO Server. May 25 12:56:33 server-xo xo-server[3211]: file:///opt/xen-orchestra/packages/xo-server/dist/api/disk.mjs:6 May 25 12:56:33 server-xo xo-server[3211]: import { format } from 'json-rpc-peer'; May 25 12:56:33 server-xo xo-server[3211]: ^^^^^^ May 25 12:56:33 server-xo xo-server[3211]: SyntaxError: Named export 'format' not found. The requested module 'json-rpc-peer' is a CommonJS module, which may not support all module.exports as named exports. May 25 12:56:33 server-xo xo-server[3211]: CommonJS modules can always be imported via the default export, for example using: May 25 12:56:33 server-xo xo-server[3211]: import pkg from 'json-rpc-peer'; May 25 12:56:33 server-xo xo-server[3211]: const { format } = pkg; May 25 12:56:33 server-xo xo-server[3211]: at ModuleJob._instantiate (internal/modules/esm/module_job.js:104:21) May 25 12:56:33 server-xo xo-server[3211]: at async ModuleJob.run (internal/modules/esm/module_job.js:149:5) May 25 12:56:33 server-xo xo-server[3211]: at async Loader.import (internal/modules/esm/loader.js:166:24) May 25 12:56:33 server-xo xo-server[3211]: at async Object.loadESM (internal/process/esm_loader.js:68:5) May 25 12:56:33 server-xo systemd[1]: xo-server.service: Main process exited, code=exited, status=1/FAILURE May 25 12:56:33 server-xo systemd[1]: xo-server.service: Failed with result 'exit-code'. May 25 12:56:33 server-xo systemd[1]: xo-server.service: Scheduled restart job, restart counter is at 1. May 25 12:56:33 server-xo systemd[1]: Stopped XO Server.
-
You may want to try the recommended solutions from this issue -- https://github.com/vatesfr/xen-orchestra/issues/5784
-
Hi,
How did you update it?
-
Try updating to node 14.17, which I believe will solve your issue.
-
@olivierlambert
I know it's not officially recommended or support but I'm using the updater from https://github.com/Jarli01/xenorchestra_updater@danp
Updated to node 14.17 but still has an error but different...May 26 11:45:46 server-xo xo-server[1908]: (node:1908) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension. May 26 11:45:46 server-xo xo-server[1908]: (Use `node --trace-warnings ...` to show where the warning was created) May 26 11:45:46 server-xo xo-server[1908]: /opt/xen-orchestra/packages/xo-server/dist/xapi/mixins/index.js:2 May 26 11:45:46 server-xo xo-server[1908]: import _gpu, * as __gpu from "./gpu"; May 26 11:45:46 server-xo xo-server[1908]: ^^^^^^ May 26 11:45:46 server-xo xo-server[1908]: SyntaxError: Cannot use import statement outside a module May 26 11:45:46 server-xo xo-server[1908]: at wrapSafe (internal/modules/cjs/loader.js:984:16) May 26 11:45:46 server-xo xo-server[1908]: at Module._compile (internal/modules/cjs/loader.js:1032:27) May 26 11:45:46 server-xo xo-server[1908]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10) May 26 11:45:46 server-xo xo-server[1908]: at Module.load (internal/modules/cjs/loader.js:933:32) May 26 11:45:46 server-xo xo-server[1908]: at Function.Module._load (internal/modules/cjs/loader.js:774:14) May 26 11:45:46 server-xo xo-server[1908]: at ModuleWrap.<anonymous> (internal/modules/esm/translators.js:199:29) May 26 11:45:46 server-xo xo-server[1908]: at ModuleJob.run (internal/modules/esm/module_job.js:152:23) May 26 11:45:46 server-xo xo-server[1908]: at async Loader.import (internal/modules/esm/loader.js:177:24) May 26 11:45:46 server-xo xo-server[1908]: at async Object.loadESM (internal/process/esm_loader.js:68:5) May 26 11:45:46 server-xo systemd[1]: xo-server.service: Main process exited, code=exited, status=1/FAILURE May 26 11:45:46 server-xo systemd[1]: xo-server.service: Failed with result 'exit-code'. May 26 11:45:46 server-xo systemd[1]: xo-server.service: Scheduled restart job, restart counter is at 89. May 26 11:45:46 server-xo systemd[1]: Stopped XO Server. May 26 11:45:46 server-xo systemd[1]: Started XO Server.
-
@deoccultist said in SyntaxError: Named export 'format' not found. The requested module 'json-rpc-peer' is a CommonJS module:
FYI: I've tried the updater too and getting the same failure
-
@deoccultist This was also reported in another thread. If may be due to changes published earlier today.
-
You may want to try the recommended solutions from this issue -- https://github.com/vatesfr/xen-orchestra/issues/5784
-
@danp Thanks for the tips...
Ran the command to do a force rebuild and started up ok now...sudo curl https://raw.githubusercontent.com/Jarli01/xenorchestra_updater/master/xo-update.sh | bash -s -- -f