node.js報錯:Cannot find module 'ejs'的解決辦法
發(fā)現(xiàn)問題
最近同事問了一個問題,他在用node.js的時候,發(fā)現(xiàn)node.js報錯了,錯誤顯示:
Error: Cannot find module 'ejs' at Function.Module._resolveFilename (module.js:325:15) at Function.Module._load (module.js:276:25) at Module.require (module.js:353:17) at require (internal/module.js:12:17) at new View (d:\WebClient\webstormSpace\day6shuoshuo\node_modules\express\lib\view.js:78:30) at EventEmitter.render (d:\WebClient\webstormSpace\day6shuoshuo\node_modules\express\lib\application.js:569:12) at ServerResponse.render (d:\WebClient\webstormSpace\day6shuoshuo\node_modules\express\lib\response.js:961:7) at exports.showIndex (d:\WebClient\webstormSpace\day6shuoshuo\routes\router.js:7:9) at Layer.handle [as handle_request] (d:\WebClient\webstormSpace\day6shuoshuo\node_modules\express\lib\router\layer.js:95:5) at next (d:\WebClient\webstormSpace\day6shuoshuo\node_modules\express\lib\router\route.js:131:13)
后來通過查找資料,發(fā)現(xiàn)原因是因為:沒有安裝ejs模塊
解決辦法:
cmd進入到項目目錄,安裝ejs:npm install --save ejs
總結
以上就是這文章的全部內(nèi)容了,希望本文的內(nèi)容對大家的學習或者工作能帶來一定的幫助,如果有疑問大家可以留言交流。
- js控制臺報錯Uncaught TypeError: Cannot read properties of undefined (reading ‘a(chǎn)ppendChild‘)的解決
- JavaScript報錯:Uncaught TypeError: Cannot set property ‘X‘ of undefine的解決方案
- 關于js復制內(nèi)容到瀏覽器剪貼板報錯:Cannot read properties of undefined (reading ‘writeText‘)的解決方案
- Node.js報錯信息Error:?Cannot?find?module?'XXX'問題及解決
- vue項目啟動后,js-base64依賴報錯Cannot read properties of null(reading ‘replace’)問題
- JavaScript中報錯Cannot?set?properties?of?undefined?(setting?‘1‘)解決方案
相關文章
no-vnc和node.js實現(xiàn)web遠程桌面的完整步驟
這篇文章主要給大家介紹了關于no-vnc和node.js實現(xiàn)web遠程桌面的完整步驟,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面來一起學習學習吧2019-08-08Node.js包管理器代理工具Verdaccio輕松創(chuàng)建管理本地npm包倉庫
這篇文章主要為大家介紹了Node.js包管理器代理工具Verdaccio輕松創(chuàng)建管理本地npm包倉庫的使用詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪2023-10-10[將免費進行到底]在Amazon的一年免費服務器上安裝Node.JS, NPM和OurJS博客
此文是介紹如何在Amazon的一年免費計劃上安裝Node.JS, NPM還有搭建OurJS博客系統(tǒng)。,需要的朋友可以參考下2014-08-08node.js使用express-fileupload中間件實現(xiàn)文件上傳
本文使用express作為服務端,使用express-fileupload庫提供的中間件函數(shù)來接受從客戶端傳來的圖片,并將圖片作為文件存儲在服務端,感興趣的可以了解一下2021-07-07