kit icon indicating copy to clipboard operation
kit copied to clipboard

Error "--use-openssl-ca is not allowed in NODE_OPTIONS" after upgrade 1.15.2->1.18.0

Open pboguslawski opened this issue 1 year ago • 1 comments

Describe the bug

Project that compiles fine with @sveltejs/kit 1.15.2 and

NODE_OPTIONS=--use-openssl-ca

present in environment (required for custom npm package registry to work), after upgrading kit to 1.18.0 with

npm update --save @sveltejs/kit

throws an error

[vite-plugin-sveltekit-compile] Initiated Worker with invalid NODE_OPTIONS env variable: --use-openssl-ca is not allowed in NODE_OPTIONS
✓ built in 8.82s
error during build:
Error [PLUGIN_ERROR]: Initiated Worker with invalid NODE_OPTIONS env variable: --use-openssl-ca is not allowed in NODE_OPTIONS
    at new NodeError (node:internal/errors:387:5)
    at new Worker (node:internal/worker:198:13)
    at file:///my/project/node_modules/@sveltejs/kit/src/utils/fork.js:37:19
    at new Promise (<anonymous>)
    at fn (file:///my/project/node_modules/@sveltejs/kit/src/utils/fork.js:36:10)
    at Object.handler (file:///my/project/node_modules/@sveltejs/kit/src/exports/vite/index.js:676:28)
    at file:///my/project/node_modules/rollup/dist/es/shared/node-entry.js:24395:40
    at async PluginDriver.hookParallel (file:///my/project/node_modules/rollup/dist/es/shared/node-entry.js:24317:17)
    at async file:///my/project/node_modules/rollup/dist/es/shared/node-entry.js:25678:13
    at async catchUnfinishedHookActions (file:///my/project/node_modules/rollup/dist/es/shared/node-entry.js:24758:20)

on compilation.

Attached diff of files changed with update as above. kit_update.zip

Reproduction

As above.

Logs

No response

System Info

Checked in Debian 10 & 11 with
    Node: 16.20.0 - /usr/bin/node
    npm: 8.19.4 - /usr/bin/npm

Severity

blocking an upgrade

Additional Information

No response

pboguslawski avatar May 19 '23 15:05 pboguslawski

I'm running into this too, any updates or workarounds?

gregroyal avatar Jun 21 '23 14:06 gregroyal

Just tested that this problem does not occur in 1.16.3 but occurs in 1.17.0.

Maybe switch from child processes to workers in https://github.com/sveltejs/kit/commit/2e6da9496bdace2c65040b9d1845c44801ca868c requires also to adjust environment variable NODE_OPTIONS as error message says?

Similar problems:

  • https://github.com/avajs/ava/discussions/3148
  • https://github.com/parcel-bundler/parcel/issues/6569

pboguslawski avatar Jan 18 '24 16:01 pboguslawski

Checked, that applying reverted https://github.com/sveltejs/kit/pull/9919/files over v1.17.0 resolves the issue. This confirms that problem was introduced in https://github.com/sveltejs/kit/pull/9919/files

Dirty workaround that works for us is to unset NODE_OPTIONS environment variable only for npm run build / npm run dev and leave it for other npm commands (i.e. install / update).

pboguslawski avatar Jan 18 '24 19:01 pboguslawski