简体   繁体   English

在生产模式下部署角度示例应用程序时出现404错误

[英]404 error when deploying angular sample app in production mode

Following an Angular tutorial about deploying the app locally in production mode i failed to do so even using the sample app. 遵循有关在生产模式下本地部署应用程序的Angular教程之后,即使使用示例应用程序,我也未能做到。 Steps: 脚步:

  1. ng new prod-app
  2. ng build --prod
  3. http-server /dist/prod-app <-- Used in tutorial http-server /dist/prod-app <-在教程中使用
  4. lite-server --baseDir="dist/prod-proj" <-- In Angular Docs lite-server --baseDir="dist/prod-proj" <-在Angular Docs中

using both servers result in the same behavior, Blank page an a 404 error 使用两个服务器导致相同的行为,空白页出现404错误

lite-server output: 精简版服务器输出:

   F:\AngularApps\prod-proj>lite-server --baseDir="dist"
   Did not detect a `bs-config.json` or `bs-config.js` override file. Using lite-server defaults...
   ** browser-sync config **
   { injectChanges: false,
     files: [ './**/*.{html,htm,css,js}' ],
     watchOptions: { ignored: 'node_modules' },
     server: { baseDir: 'dist', middleware: [ [Function], [Function] ] }               }
   [Browsersync] Access URLs:
    -------------------------------------
          Local: http://localhost:3000
       External: http://192.168.56.1:3000
    -------------------------------------
             UI: http://localhost:3001
    UI External: http://localhost:3001
    -------------------------------------
   [Browsersync] Serving files from: dist
   [Browsersync] Watching files...
   19.08.16 08:49:20 404 GET /index.html
   19.08.16 08:49:20 404 GET /favicon.ico

There is nothing in neither the tutorial nor the docs about any extra configuration, So what am i missing? 教程和文档中都没有关于任何额外配置的内容,那么我缺少什么?

Thanks, Gado 谢谢加多

在lite-server输出中,您已指定baseDir="dist" ,将其更改为baseDir="dist/prod-proj"

 F:\AngularApps\prod-proj>lite-server --baseDir="dist/prod-proj"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将 Angular 应用程序部署到 Heroku 时出现“未找到”错误 - 'Not Found' error when deploying Angular app to Heroku Angular 应用程序在生产服务器中重新加载给出 404 - Angular app reloading in production server gives 404 在 Google Cloud App Engine 上部署 Angular 通用应用程序时出错 - Error when deploying Angular Universal app on Google Cloud App Engine 在heroku中部署Angular 2应用程序时出现错误(预期表达式,得到了&lt;&lt;) - Error (expected expression, got '<') when deploying Angular 2 app in heroku 将 Angular 应用程序部署到 Heroku,构建成功,但在浏览器中显示 404 not found - Deploying Angular app to Heroku, build was successful but in browser it shows 404 not found 将Node / Express应用程序部署到Heroku / Production - Babel / ES6错误 - Deploying Node/Express App to Heroku/Production — Babel/ES6 Error 在 Heroku 生产模式下运行 Angular + Node.js 应用程序 - Run Angular + Node.js app in production mode Heroku nodejs express 应用程序部署到生产 - nodejs express app deploying to production 获取请求在 Angular 5 应用程序中抛出 404 错误 - get request throwing 404 error in Angular 5 app 部署到生产环境时出现 ELIFECYCLE 错误 1 - ELIFECYCLE errorno 1 when deploying to production
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM