2020年12月20日星期日

Error [ERR_MODULE_NOT_FOUND]: Cannot find module

enter image description here

I'm working on a node project (screenshot). I have a single function (urls) in helpers.js which I'm exporting at the bottom as:

module.exports = {  urls: urls,  };  

In my index.js I'm trying to import it with:

import { urls } from '.helpers';  const myUrls = urls(1,3);  

When I run it I get

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/home/optionhomes11/nodeprojects/hayes/helpers' imported from /home/optionhomes11/nodeprojects/hayes/index.js Did you mean to import ../helpers.js?  

What am I doing wrong?

https://stackoverflow.com/questions/65384754/error-err-module-not-found-cannot-find-module December 21, 2020 at 05:02AM

没有评论:

发表评论