Greenheart / pagecrypt

Password Protected Single Page Applications and HTML files
GNU Affero General Public License v3.0
242 stars 26 forks source link

I keep getting an 'UnhandledPromiseRejectionWarning' when trying to run pagecrypt using npm.. #24

Closed pm-Architect closed 3 years ago

pm-Architect commented 3 years ago
pagecrypt index.html encrypted.html password

πŸ” Encrypting index.html β†’ encrypted.html with πŸ”‘: password
(node:1608) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'getRandomValues' of undefined
    at getEncryptedPayload (...*/node_modules/pagecrypt/cli.js:61:31)
    at encryptHTML (...*/node_modules/pagecrypt/cli.js:74:100)
    at encryptFile (...*/node_modules/pagecrypt/cli.js:98:16)
    at async encrypt (...*/node_modules/pagecrypt/cli.js:107:21)
    at async ...*/node_modules/pagecrypt/cli.js:129:5
(Use `node --trace-warnings ...` to show where the warning was created)
(node:1608) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)     
(node:1608) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Am I missing something?

Greenheart commented 3 years ago

Hi! Are you using Node.js v15 or newer?

I recommend using Node.js v16, which will be the next LTS release in October 2021.

node -v

Let me know if this helps! πŸ™‚

Greenheart commented 3 years ago

I added the recommended Node.js versions to package.json a while back, but that's not clear enough.

I'm adding a note to the README file to make sure more people see it :)

Greenheart commented 3 years ago

@pm-Architect I'll assume upgrading Node.js solved your issue - let me know if you find anything else.

Have a nice day! :)

pm-Architect commented 3 years ago

Yes it did. Thanks! πŸ˜„