반응형
NUXT - 리소스 로드 실패: 서버가 404 상태로 응답했습니다.
nuxt create-app 도입에 어려움을 겪고 있습니다.
사실, 내가 달릴 때$ npm run generate
잘못된 경로를 가진 dist 폴더를 생성합니다._nuxt/
폴더입니다.
.html 파일의 올바른 상대 경로를 입력한다._nuxt/test.js
가 아니라/_nuxt/test.js
(첫 번째 "/"는 생략). 루트 디렉토리에서 파일을 검색하기 때문입니다.
이미 몇 시간이고 찾아봤지만 유효한 해결책을 찾을 수가 없어요.SSR 모드에서 nuxtjs 웹 사이트를 게시할 때 이 오류를 발견했는데, 실제로 구현 방법을 이해하지 못했습니다. ngix란 무엇입니까? 수정해야 하는 파일은 무엇입니까?몰라.
여기 nuxt.config.js 아래
const pkg = require('./package')
module.exports = {
mode: 'universal',
/*
** Headers of the page
*/
head: {
title: pkg.name,
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: pkg.description },
{ hid: 'keywords', name: 'keywords', content: 'pellet, pellets, madrid, cuenca, segovia, toledo, guadalajara' }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
{ rel: 'stylesheet', href: 'https://fonts.googleapis.com/css?family=Merriweather|Open+Sans'},
{ rel: 'stylesheet', href: 'assets/fonts/fontawesome/css/all.css'}
]
},
/*
** Customize the progress-bar color
*/
loading: { color: '#fff' },
/*
** Global CSS
*/
css: [
// SCSS file in the project
'@/assets/css/main.scss'
],
/*
** Plugins to load before mounting the App
*/
plugins: [
'@/plugins/vee-validate'
],
/*
** Nuxt.js modules
*/
modules: [
// Doc: https://axios.nuxtjs.org/usage
'@nuxtjs/axios',
// Doc: https://bootstrap-vue.js.org/docs/
'bootstrap-vue/nuxt'
],
/*
** Axios module configuration
*/
axios: {
// See https://github.com/nuxt-community/axios-module#options
},
/*
** Build configuration
*/
build: {
/*
** You can extend webpack config here
*/
extend(config, ctx) {
// Run ESLint on save
if (ctx.isDev && ctx.isClient) {
config.module.rules.push({
enforce: 'pre',
test: /\.(js|vue)$/,
loader: 'eslint-loader',
exclude: /(node_modules)/,
options : {
fix : true
}
})
}
},
/*
** POST CSS
*/
postcss: {
// Add plugin names as key and arguments as value
// Install them before as dependencies with npm or yarn
//postcss-loader autoprefixer
plugins: {
// Disable a plugin by passing false as value
// 'postcss-url': false,
// 'postcss-nested': false,
// 'postcss-responsive-type': false,
'postcss-hexrgba': {}
},
preset: {
// Change the postcss-preset-env settings
autoprefixer: {
grid: true
}
}
}
}
}
이 악몽을 해결할 수 있도록 도와주세요.대단히 고맙습니다,
빌드 설정으로 Hasan이 어떻게 처리되는지 잘 모르겠습니다.publicPath
"public"으로 표시됩니다.
저 같은 경우에는 방금 교체했습니다.public/
와 함께.nuxt/dist/client/
나한테는 잘된 것 같아요.
추신.nuxt/
보이지 않는 폴더입니다.
프로덕션용 개별 파일을 생성하고 다시 빌드해야 합니다.
- pm2 init (이 에코시스템 구성 파일 작성 후)
- pm2 시작
응용 프로그램이 도메인에서 성공적으로 실행되었습니다.
언급URL : https://stackoverflow.com/questions/54615007/nuxt-failed-to-load-resource-the-server-responded-with-a-status-of-404
반응형
'programing' 카테고리의 다른 글
오류 LNK2005: xxx가 MSVCRT.lib(MSVCR100.dll) C:\something\에 이미 정의되어 있습니다.LIBCMT.lib(setlocal.obj) (0) | 2022.07.31 |
---|---|
Vuetify - 확인란 그룹을 올바르게 검증하는 방법 (0) | 2022.07.31 |
Swift에서의 SCNetwork Reachability 사용방법 (0) | 2022.07.31 |
유닛 테스트를 대규모 레거시(C/C++) 코드베이스에 도입하려면 어떻게 해야 합니까? (0) | 2022.07.31 |
모든 테스트 도메인에서 작동하도록 Vue/Webpack에서 핫 새로고침을 구성하는 방법 (0) | 2022.07.31 |