Open ctaoist opened 7 years ago
请看一下你的博客根目录/node_modules/hexo/node_modules/目录下是否有
├─cheerio
├─lodash
这两个目录,如果没有,可以在博客根目录/node_modules/hexo下安装这两个插件
npm install cheerio --save
npm install lodash --save
装了之后在 博客根目录/node_modules/下有lodash,而博客根目录/node_modules/hexo/node_modules/下是没有的. cheerio是在两者下都有 直接修改相应js中lodash的位置可以?
@275761919 已修改我之前的备注。
'../../../node_modules/hexo/node_modules/lodash' 指向的位置是博客根目录/node_modules/hexo/node_modules/lodash
。你的cheerio在hexo的依赖中,那么不应该出现Error: Cannot find module '../../../node_modules/hexo/node_modules/cheerio'
(对此,我很奇怪)。
暂且不管。万能的解决办法是:
require ('lodash');
require ('cheerio');
即可
提示: Error: Cannot find module '../../../node_modules/hexo/node_modules/lodash' Error: Cannot find module '../../../node_modules/hexo/node_modules/cheerio' 导致失败 我的hexo是3.x