Giter Site home page Giter Site logo

Comments (12)

karthikeyana avatar karthikeyana commented on May 12, 2024 1

use this code to solve the issue

app.get('/', function(req, res){
    res.render("index");
});

from generator-angular-fullstack.

DaftMonk avatar DaftMonk commented on May 12, 2024

You need to run node in production mode for the distribution build.

E.g.

$ NODE_ENV=production node server.js

from generator-angular-fullstack.

ddad10 avatar ddad10 commented on May 12, 2024

I get the same error running in production

from generator-angular-fullstack.

dearlordylord avatar dearlordylord commented on May 12, 2024

edited just realized that I forgot Grunt stuff. Sorry.

from generator-angular-fullstack.

adeperio avatar adeperio commented on May 12, 2024

Hey Im getting this issue too...can run dist locally but when I deploy to heroku i get this error

from generator-angular-fullstack.

jhurray avatar jhurray commented on May 12, 2024

same here.... any fix yet?

from generator-angular-fullstack.

tgienger avatar tgienger commented on May 12, 2024

For me I had to go into lib/config/express.js and change:

app.use(express.favicon(path.join(config.root, '/app', 'favicon.ico')));
app.use(express.static(path.join(config.root, '/app')));
app.set('views', config.root + '/app/views');

To:

app.use(express.favicon(path.join(config.root, '/', 'favicon.ico')));
app.use(express.static(path.join(config.root, '/')));
app.set('views', config.root + '/views');

from generator-angular-fullstack.

huangjihua avatar huangjihua commented on May 12, 2024

Error: Failed to lookup view "index" in views directory "./views"
at EventEmitter.app.render (K:\项目\steven\GitHub\imooc-project2\imooc\node_modules\express\lib\application.js:519:17)
at ServerResponse.res.render (K:\项目\steven\GitHub\imooc-project2\imooc\node_modules\express\lib\response.js:904:7)
at app.get.res.render.title (K:\项目\steven\GitHub\imooc-project2\imooc\app.js:16:13)
at Layer.handle as handle_request
at next (K:\项目\steven\GitHub\imooc-project2\imooc\node_modules\express\lib\router\route.js:100:13)
at Route.dispatch (K:\项目\steven\GitHub\imooc-project2\imooc\node_modules\express\lib\router\route.js:81:3)
at Layer.handle as handle_request
at K:\项目\steven\GitHub\imooc-project2\imooc\node_modules\express\lib\router\index.js:235:24
at Function.proto.process_params (K:\项目\steven\GitHub\imooc-project2\imooc\node_modules\express\lib\router\index.js:313:12)
at K:\项目\steven\GitHub\imooc-project2\imooc\node_modules\express\lib\router\index.js:229:12

from generator-angular-fullstack.

tpflueger avatar tpflueger commented on May 12, 2024

Was anything solved on this? I keep having the same error as above and wasn't able to fix it.

from generator-angular-fullstack.

akhil-sharma25 avatar akhil-sharma25 commented on May 12, 2024

I fixed this error as I got it couple of times:
app.get('/', function(req, res){
res.render("/index");
});
never put "/" before rendering instead use :
app.get('/', function(req, res){
res.render("index");
});

from generator-angular-fullstack.

juanjosejaramillo avatar juanjosejaramillo commented on May 12, 2024

Make sure that your folder is in the proper path. Accidentally I placed the folder inside my controllers folder and that's why I was getting that error.

from generator-angular-fullstack.

Yohei-Shiina avatar Yohei-Shiina commented on May 12, 2024

I had the same issue and it turned out that I named views/index as index."js" but "jsx"

from generator-angular-fullstack.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.