New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: settings.root required #2

Open
sumaolin opened this Issue May 9, 2016 · 3 comments

Comments

Projects
None yet
2 participants
@sumaolin

sumaolin commented May 9, 2016

  Error: settings.root required
      at module.exports (F:\Users\dev\bbs\node_modules\co-ejs\lib\ejs.js:149:11)

      at Object.<anonymous> (F:\Users\dev\bbs\index.js:55:9)
      at next (native)
      at Object.ejs (F:\Users\dev\bbs\node_modules\co-ejs\lib\ejs.js:186:12)
      at next (native)
      at Object.<anonymous> (F:\Users\dev\bbs\node_modules\koa-compose\index.js:
28:19)
      at next (native)
      at onFulfilled (F:\Users\dev\bbs\node_modules\co\index.js:65:19)
      at F:\Users\dev\bbs\node_modules\co\index.js:54:5
      at Object.co (F:\Users\dev\bbs\node_modules\co\index.js:50:10)


  Error: settings.root required
      at module.exports (F:\Users\dev\bbs\node_modules\co-ejs\lib\ejs.js:149:11)

      at Object.<anonymous> (F:\Users\dev\bbs\index.js:55:9)
      at next (native)
      at Object.ejs (F:\Users\dev\bbs\node_modules\co-ejs\lib\ejs.js:186:12)
      at next (native)
      at Object.<anonymous> (F:\Users\dev\bbs\node_modules\koa-compose\index.js:
28:19)
      at next (native)
      at onFulfilled (F:\Users\dev\bbs\node_modules\co\index.js:65:19)
      at F:\Users\dev\bbs\node_modules\co\index.js:54:5
      at Object.co (F:\Users\dev\bbs\node_modules\co\index.js:50:10)

window 环境中使用报错,代码是按模版系统 代码来的

已解决了,自己少写东西了

@nswbmw

This comment has been minimized.

Show comment
Hide comment
@nswbmw

nswbmw May 9, 2016

Owner

有传 root 这个配置吗

Owner

nswbmw commented May 9, 2016

有传 root 这个配置吗

@sumaolin

This comment has been minimized.

Show comment
Hide comment
@sumaolin

sumaolin May 9, 2016

@nswbmw 传了,刚才那个是使用render 的时候忘了前面的this,

  Error: ENOENT: no such file or directory, open 'F:\Users\dev\bbs\views\layout.
html'
      at Error (native)
      at Object.fs.openSync (fs.js:549:18)
      at fs.readFileSync (fs.js:397:15)
      at exports.renderFile (F:\Users\dev\bbs\node_modules\co-ejs\lib\ejs.js:409
:37)
      at next (native)
      at Object.app.context.render (F:\Users\dev\bbs\node_modules\co-ejs\lib\ejs
.js:171:21)
      at next (native)
      at onFulfilled (F:\Users\dev\bbs\node_modules\co\index.js:65:19)

我里面没有调用layout 的模板,只是在配置的时候,有:

app.use(render(app, {
  root: path.join(__dirname, 'views'),
  layout: 'layout',
  viewExt: 'html',
  cache: true,
  debug: false,
  locals: locals,
  filters: filter
}));

sumaolin commented May 9, 2016

@nswbmw 传了,刚才那个是使用render 的时候忘了前面的this,

  Error: ENOENT: no such file or directory, open 'F:\Users\dev\bbs\views\layout.
html'
      at Error (native)
      at Object.fs.openSync (fs.js:549:18)
      at fs.readFileSync (fs.js:397:15)
      at exports.renderFile (F:\Users\dev\bbs\node_modules\co-ejs\lib\ejs.js:409
:37)
      at next (native)
      at Object.app.context.render (F:\Users\dev\bbs\node_modules\co-ejs\lib\ejs
.js:171:21)
      at next (native)
      at onFulfilled (F:\Users\dev\bbs\node_modules\co\index.js:65:19)

我里面没有调用layout 的模板,只是在配置的时候,有:

app.use(render(app, {
  root: path.join(__dirname, 'views'),
  layout: 'layout',
  viewExt: 'html',
  cache: true,
  debug: false,
  locals: locals,
  filters: filter
}));
@sumaolin

This comment has been minimized.

Show comment
Hide comment
@sumaolin

sumaolin May 9, 2016

看demo 中的文件,例子可以运行了,但是为什么需要layout.html 文件,是怎么个流程能详细说下吗?

看了setting 都明白了 自己蠢哭了!

sumaolin commented May 9, 2016

看demo 中的文件,例子可以运行了,但是为什么需要layout.html 文件,是怎么个流程能详细说下吗?

看了setting 都明白了 自己蠢哭了!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment