16

I need help with my NuxtJS application.

I recently had ESLint conflicts in the app after I left it for some time without updating (2 months). So after I started working on it, it presented a challenge trying to resolve the ESLint issue. I then had to migrate the project to a newer version of Node and ESLint.

After doing this, I solved the conflict issue and my project could install my dependencies, but now the server won't start. Node is now throwing an error that I don't even know how to fix. I don't know if many others are facing this issue after upgrading their versions of Node.js, but it's throwing an error about an unsupported hash function.

Here is a screenshot of the terminal error that is preventing my server from starting up:

Node error, server won't start

I have resolved all ESLint and syntax errors that came with the migration, so I don't know what else to do.

Below is a snippet of my nuxt.config.js file:

export default {
  // Global page headers: https://go.nuxtjs.dev/config-head
  head: {
    title: 'heritage-fd',
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      { hid: 'description', name: 'description', content: '' },
      { name: 'format-detection', content: 'telephone=no' }
    ],
    
    link: [
      { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
    ],
    
    script: [
      {
        src: '~/static/css/bootstrap.min.js',
      },
    ],
  },

  // Global CSS: https://go.nuxtjs.dev/config-css
  css: [
    {src: '~/static/css/bootstrap.min.css', lang: 'scss'},
    {src: '~/assets/scss/custom.scss', lang: 'scss'},
    {src: "~layouts/global.css"},
    {src: '~/static/css/style.css', lang: 'scss'},
    {src: '~/assets/css/main.css'}
    
  ],

  // Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
   plugins: [
    "~/plugins/vee-validate.js",
    { src: '~/plugins/persistedState.client.js', ssr: false }
   ],

  // Auto import components: https://go.nuxtjs.dev/config-components
  components: true,

  // Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
  buildModules: [
    // https://go.nuxtjs.dev/eslint
    '@nuxtjs/eslint-module',
    'nuxt-gsap-module',
    '@nuxtjs/fontawesome',
  ],

  // Modules: https://go.nuxtjs.dev/config-modules
  modules: [
    // https://go.nuxtjs.dev/axios
    '@nuxtjs/axios',
    // https://go.nuxtjs.dev/pwa
    '@nuxtjs/pwa',
    '@nuxtjs/auth-next',
    'nuxt-vue-select'
  ],

  // Axios module configuration: https://go.nuxtjs.dev/config-axios
  axios: {
    // Workaround to avoid enforcing hard-coded localhost:3000: https://github.com/nuxt-community/axios-module/issues/308
    baseURL: 'http://localhost:8000/api/',
    
  },

  // PWA module configuration: https://go.nuxtjs.dev/pwa
   pwa: {
    manifest: {
      lang: 'en',
    },
  },

  // Build Configuration: https://go.nuxtjs.dev/config-build
 build: {
    transpile: ["vee-validate/dist/rules"],
    vendor: ["vue-tables-2"]
  },
}
JSON Derulo
  • 9,780
  • 7
  • 39
  • 56
Romanric Akam
  • 663
  • 1
  • 5
  • 13
  • Did you tried to delete your `node_modules`, reinstall with yarn/pnpm to check some errors? Also, do you have the `package.json` before and after? Mind sharing the `nuxt.config.js` file too? – kissu Nov 23 '22 at 15:24
  • Yes i did that, yes sure, i will share my nuxt config file – Romanric Akam Nov 23 '22 at 20:35
  • What about the rest? – kissu Nov 23 '22 at 21:01
  • 2
    Does this answer your question? [Error message "error:0308010C:digital envelope routines::unsupported"](https://stackoverflow.com/questions/69692842/error-message-error0308010cdigital-envelope-routinesunsupported) – segFault Nov 23 '22 at 21:06
  • NO deleting the node_modules doesnt fix the problem, @kissu what rest? are you refering to, thats my entire nuxt.config file. – Romanric Akam Nov 23 '22 at 21:52

6 Answers6

32

Concerning this error, after doing some much research, i finally discovered that the whole error comes with the nodejs upgrade to version v18.12.1, so i advice everyone facing this same issue who just recently upgraded tio node v18.12.1 to downgrade back to node v16.0.0, if u need help with this , you can use nvm.

some steps are outlined below, with some link to resources

`

  1. Download and install nvm Follow instructions here
  1. Install Nodejs v16.0.0 nvm install 16.0.0

  2. Uninstall nodejs v18.12.1 nvm uninstall 18.12.1 or your own version of node

I truly this helps someone as it did for me, I know the pains that come with framework errors. Please comment if you need further assistance. thank you.

Romanric Akam
  • 663
  • 1
  • 5
  • 13
  • 1
    Worked for me. On windows you just uninstall node.js 18 as per usual, then download/install 16. – Andrew Dec 01 '22 at 01:03
  • 1
    Consider the warnings in this - https://stackoverflow.com/a/73027407/1459653 - answer before doing this. – Mark Gavagan Jan 11 '23 at 18:44
  • 4
    that's not the fix. You need to upgrade the outdated libs that use an outdated SSL instead not the other way around. In my case it was an older version of webpack. @MarkGavagan comment has the link that describes the correct solution. – vir us Jan 16 '23 at 20:40
  • 1
    Downgrade Node to < 17 It worked for me; I was using _react-scripts": "^4.0.0"_ ; but after seeing @MarkGavagan comment, I did a `npm audit fix --force` and it upgrade my _react-scripts": "^5.0.1"_ . After that, SSL issue solved, and it works now with Node > 17. – Marcelo Scofano Diniz Jan 22 '23 at 14:48
24

In my case this happened in my Github Actions build pipeline when I was running npm run build.

I was able to fix it by providing the following environment argument:

export NODE_OPTIONS=--openssl-legacy-provider

According from what I have read this node option can also be set in package.json.

This seems a bit easier than downgrading nodejs to v16.

finisinfinitatis
  • 861
  • 11
  • 23
12

Checking the solutions here, I decided to install node@16.0.0 as a development dependency in the project.

npm install node@16.0.0 --save-dev

Then include in the scripts the command "dev": "npm run serve".

"scripts": {
    "dev": "npm run serve",
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint"
},

This will make it so that when you run the command "npm run dev"

npm run dev

it will run the script using the node of your project's dependencies.

Michel
  • 157
  • 5
  • 1
    This works for me and is a great solution, much easier than downgrading your global node version or messing around with NVM. – Daniel Davies Jun 17 '23 at 13:20
7

I spent a lot of time solving the problem. If you are using Fedora and you get this error

try run your project with flag: NODE_OPTIONS=--openssl-legacy-provider example: "dev": "NODE_OPTIONS=--openssl-legacy-provider next -p 4000"

If it helped you, then you can set it to Node environments

  • check your options in console echo $NODE_OPTIONS
  • if options is empty, set it export NODE_OPTIONS=--openssl-legacy-provider

I use 16.17.1 version of NodeJs, set NODE_OPTIONS var helped me.

If this does not help, then try the last step, try to uncomment the following lines in your /etc/ssl/openssl.cnf file.

Erik Khasanov
  • 71
  • 1
  • 2
0

you can go with answer given by Romanric AKAM, but if you have multiple project which require different node version(in my case i have two project which are dependependent on different version)

So in this case go to project directory whereve you are facing this issue and run nvm install 16.0.0

Note: please insatall nvm first

-1

I noticed there was a newer version: Node-18.13.0. So I tried to update to this latest version instead of rolling back to a previous version, but it didn't work.

Then, I checked out other versions here:

https://nodejs.org/dist/

Installing version Node-v15.6.0 fixed this issue on my end. So, rolling back Node, for now, might be our best option.