Need help with my NuxtJS application.
Recently, I got an ESLint conflict in the application after I left it for a while (2 months) without updating. So after I started working on it, trying to solve the ESLint problem presented a challenge. Then I had to migrate the project to newer versions of Node and ESLint.
After doing this, I resolved the conflict issue and my project can 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 faced this issue after upgrading their Node.js version, but it threw an error about unsupported hash function.
Here is a screenshot of the terminal error that prevents my server from starting:
I've already fixed all the ESLint and syntax errors that came with the migration, so I don't know what else to do.
Here 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"] }, }
In my case, this happened in my Github Actions build pipeline when I ran
npm run build
.I was able to fix it by providing the following environment parameters:
From what I've read, this node option can also be set inpackage.json.
This seems a little easier than downgrading Nodejs to v16.
Regarding this error, after a lot of research, I finally found out that the whole error occurred when nodejs was upgraded to v18.12.1 version, so I recommend everyone who encountered the same problem and just upgraded tio node v18.12.1 to downgrade Back in node v16.0.0, if you need help with this you can use
nvm
.Some steps are outlined below, along with links to some resources
`
Install Nodejs v16.0.0
nvm installation 16.0.0
Uninstall nodejs v18.12.1
nvm uninstall 18.12.1
or your own node versionI do know this will help someone, as it did for me, I know the pain of framing errors. If you need further assistance please leave a comment. Thanks.