我正在尝试完成教程:
但我想使用最新的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.json
和package-lock.json
有pug
,没有jade
。
我尝试将jade
替换为pug
中的app.js
:
app.set('查看引擎',' jade') - > app.set('查看引擎',' pug')
但它仍然无法运行仍然出错:
错误:无法查找视图"错误"在视图目录
中