Ich brauche Hilfe bei meiner NuxtJS-Anwendung.
Kürzlich bekam ich einen ESLint-Konflikt in der Anwendung, nachdem ich sie eine Weile (2 Monate) ohne Aktualisierung gelassen hatte. Nachdem ich mit der Arbeit daran begonnen hatte, stellte der Versuch, das ESLint-Problem zu l?sen, eine Herausforderung dar. Dann musste ich das Projekt auf neuere Versionen von Node und ESLint migrieren.
Danach habe ich das Konfliktproblem gel?st und mein Projekt kann meine Abh?ngigkeiten installieren, aber jetzt startet der Server nicht. Node gibt jetzt einen Fehler aus, den ich nicht einmal beheben kann. Ich wei? nicht, ob viele andere nach dem Upgrade ihrer Node.js-Version mit diesem Problem konfrontiert sind, aber es gibt einen Fehler bezüglich der nicht unterstützten Hash-Funktion aus.
Hier ist ein Screenshot des Terminalfehlers, der den Start meines Servers verhindert:
Ich habe bereits alle ESLint- und Syntaxfehler behoben, die mit der Migration einhergingen, daher wei? ich nicht, was ich sonst noch tun soll.
Hier ist ein Ausschnitt meiner nuxt.config.js-Datei:
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"] }, }
就我而言,當(dāng)我運(yùn)行 npm run build
時(shí),這發(fā)生在我的 Github Actions 構(gòu)建管道中。
我能夠通過(guò)提供以下環(huán)境參數(shù)來(lái)修復(fù)它:
export NODE_OPTIONS=--openssl-legacy-provider
根據(jù)我所讀到的內(nèi)容,這個(gè)節(jié)點(diǎn)選項(xiàng)也可以在 package.json 中設(shè)置。
這似乎比將 Nodejs 降級(jí)到 v16 容易一些。
關(guān)于這個(gè)錯(cuò)誤,經(jīng)過(guò)大量研究后,我終于發(fā)現(xiàn)整個(gè)錯(cuò)誤是在nodejs升級(jí)到v18.12.1版本時(shí)出現(xiàn)的,所以我建議所有遇到同樣問(wèn)題的最近剛剛升級(jí)tio node v18.12.1的人降級(jí)回到節(jié)點(diǎn) v16.0.0,如果您需要這方面的幫助,您可以使用 nvm
。
下面概述了一些步驟,以及一些資源鏈接
`
安裝 Nodejs v16.0.0
nvm安裝16.0.0
卸載nodejs v18.12.1
nvm uninstall 18.12.1
或您自己的節(jié)點(diǎn)版本
我確實(shí)這對(duì)某人有幫助,就像對(duì)我一樣,我知道框架錯(cuò)誤帶來(lái)的痛苦。如果您需要進(jìn)一步幫助,請(qǐng)發(fā)表評(píng)論。 謝謝。