Skip to content

Trouble running nuxt without environment variable #2

@napulen

Description

@napulen

Trying to run the command npm run dev resulted in the following error for me:

> [email protected] dev
> nuxt

ℹ Parsed 23 files in 0.6 seconds                                                                                                                                                         @nuxt/content 21:04:02

   ╭────────────────────────────────────────────╮
   │                                            │
   │   Nuxt @ v2.15.8                           │
   │                                            │
   │   ▸ Environment: development               │
   │   ▸ Rendering:   server-side               │
   │   ▸ Target:      server                    │
   │                                            │
   │   Listening: http://0.0.0.0:3000/   │
   │                                            │
   ╰────────────────────────────────────────────╯

ℹ Preparing project for development                                                                                                                                                                    21:04:03
ℹ Initial build may take a while                                                                                                                                                                       21:04:03
ℹ Discovered Components: .nuxt/components/readme.md                                                                                                                                                    21:04:03
✔ Builder initialized                                                                                                                                                                                  21:04:03
✔ Nuxt files generated                                                                                                                                                                                 21:04:03

● Client █████████████████████████ compiling (0%)


◯ Server


node:internal/crypto/hash:71
  this[kHandle] = new _Hash(algorithm, xofLen);
                  ^

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:71:19)
    at Object.createHash (node:crypto:140:10)
    at module.exports (/home/napulen/vimu/node_modules/webpack/lib/util/createHash.js:135:53)
    at NormalModule._initBuildHash (/home/napulen/vimu/node_modules/webpack/lib/NormalModule.js:417:16)
    at handleParseError (/home/napulen/vimu/node_modules/webpack/lib/NormalModule.js:471:10)
    at /home/napulen/vimu/node_modules/webpack/lib/NormalModule.js:503:5
    at /home/napulen/vimu/node_modules/webpack/lib/NormalModule.js:358:12
    at /home/napulen/vimu/node_modules/webpack/node_modules/loader-runner/lib/LoaderRunner.js:373:3
    at iterateNormalLoaders (/home/napulen/vimu/node_modules/webpack/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
    at Array.<anonymous> (/home/napulen/vimu/node_modules/webpack/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
    at Storage.finished (/home/napulen/vimu/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
    at /home/napulen/vimu/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
    at /home/napulen/vimu/node_modules/graceful-fs/graceful-fs.js:123:16
    at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3) {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

Node.js v19.6.0

I came across this solution which fixed it

export NODE_OPTIONS=--openssl-legacy-provider
> [email protected] dev
> nuxt

ℹ Parsed 23 files in 0.6 seconds                                                                                                                                                         @nuxt/content 21:04:49

   ╭────────────────────────────────────────────╮
   │                                            │
   │   Nuxt @ v2.15.8                           │
   │                                            │
   │   ▸ Environment: development               │
   │   ▸ Rendering:   server-side               │
   │   ▸ Target:      server                    │
   │                                            │
   │   Listening: http://0.0.0.0:3000/   │
   │                                            │
   ╰────────────────────────────────────────────╯

ℹ Preparing project for development                                                                                                                                                                    21:04:50
ℹ Initial build may take a while                                                                                                                                                                       21:04:50
ℹ Discovered Components: .nuxt/components/readme.md                                                                                                                                                    21:04:50
✔ Builder initialized                                                                                                                                                                                  21:04:50
✔ Nuxt files generated                                                                                                                                                                                 21:04:50

✔ Client
  Compiled successfully in 44.34s

✔ Server
  Compiled successfully in 42.35s

ℹ Waiting for file changes                                                                                                                                                                             21:05:35
ℹ Memory usage: 1.34 GB (RSS: 1.66 GB)                                                                                                                                                                 21:05:35
ℹ Listening on: http://0.0.0.0:3000/

Might be worth writing a note in the README about it. This was a fresh node v19.6 install over WSL Ubuntu.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions