SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    May 2013
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    ch4, error with portfolio.ejs

    I keep getting this error with portfolio.ejs, up until this point I have been able to figure out where the problem is. It cannot find the variable portfolio, but I have checked and I havent mispelled portfolio anywhere that I can find. Any suggestions?

    ---err----


    ReferenceError: /Users/dj/Portfolio/nmarket/views/portfolio.ejs:42
    40| </thead>
    41| <tbody class="stock-list">
    >> 42| <% for (var i=0; i<portfolio.length; i++) { %>
    43| <tr><td><%=portfolio[i]%></td>
    44| <td><%=prices[i]%></td></tr>
    45| <% } %>

    portfolio is not defined
    at Object.eval (eval at <anonymous> (/Users/dj/Portfolio/nmarket/node_modules/ejs/lib/ejs.js:209:12), <anonymous>:29:2290)
    at Object.<anonymous> (/Users/dj/Portfolio/nmarket/node_modules/ejs/lib/ejs.js:211:15)
    at ServerResponse.res._render (/Users/dj/Portfolio/nmarket/node_modules/express/lib/view.js:425:21)
    at ServerResponse.res.render (/Users/dj/Portfolio/nmarket/node_modules/express/lib/view.js:318:17)
    at module.exports.portfolio (/Users/dj/Portfolio/nmarket/routes/nockroutes.js:18:7)
    at callbacks (/Users/dj/Portfolio/nmarket/node_modules/express/lib/router/index.js:272:11)
    at param (/Users/dj/Portfolio/nmarket/node_modules/express/lib/router/index.js:246:11)
    at pass (/Users/dj/Portfolio/nmarket/node_modules/express/lib/router/index.js:253:5)
    at Router._dispatch (/Users/dj/Portfolio/nmarket/node_modules/express/lib/router/index.js:280:5)
    at Object.Router.middleware [as handle] (/Users/dj/Portfolio/nmarket/node_modules/express/lib/router/index.js:45:10)


    ----err----

    Also, the tags in the code are familiar to me from ruby. Is there a connection?

  2. #2
    SitePoint Member
    Join Date
    May 2013
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I figured it out. I just downloaded the ejs file from github for portfolio and was using that. So, the portfolio variable wasn't fully defined yet.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •