错误:找不到模块' jade' (切换到哈巴狗后)

时间:2017-12-20 20:03:49

标签: node.js express pug

我正在尝试完成教程:

https://closebrace.com/tutorials/2017-03-02/the-dead-simple-step-by-step-guide-for-front-end-developers-to-getting-up-and-running-with-nodejs-express-and-mongodb

但我想使用最新的pug来避免弃用警告。执行npm start并访问localhost:3000后,我收到以下错误:

Error: Cannot find module 'jade'
at Function.Module._resolveFilename (module.js:542:15)
at Function.Module._load (module.js:472:25)
at Module.require (module.js:585:17)
at require (internal/module.js:11:18)
at new View (/home/nikita/project/node_modules/express/lib/view.js:79:30)
at Function.render (/home/nikita/project/node_modules/express/lib/application.js:570:12)
at ServerResponse.render (/home/nikita/project/node_modules/express/lib/response.js:971:7)
at /home/nikita/project/app.js:43:7
at Layer.handle_error (/home/nikita/project/node_modules/express/lib/router/layer.js:71:5)
at trim_prefix (/home/nikita/project/node_modules/express/lib/router/index.js:315:13) 

package.jsonpackage-lock.jsonpug,没有jade

我尝试将jade替换为pug中的app.js

  

app.set('查看引擎',' jade') - > app.set('查看引擎',' pug')

但它仍然无法运行仍然出错:

  

错误:无法查找视图"错误"在视图目录

0 个答案:

没有答案