admin管理员组文章数量:1389931
function SayHello(name) {
return "hello" + name;
}
const msg = SayHello("alex");
console.log(msg);
when I right in terminal node index.js I get this error I'm not sure what's happening I Think its a path problem (I'm on m1 Mac )
ahmed@Ahmeds-MacBook-Pro Week2 CSS & some HTML % node index.js node:internal/modules/cjs/loader:936 throw err; ^
Error: Cannot find module '/Users/ahmed/WebDevCourse/Week2 CSS & some HTML/index.js' at Function.Module._resolveFilename >(node:internal/modules/cjs/loader:933:15) at Function.Module._load (node:internal/modules/cjs/loader:778:27) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) at node:internal/main/run_main_module:17:47 { code: 'MODULE_NOT_FOUND', requireStack: [] }
Node.js v17.2.0
function SayHello(name) {
return "hello" + name;
}
const msg = SayHello("alex");
console.log(msg);
when I right in terminal node index.js I get this error I'm not sure what's happening I Think its a path problem (I'm on m1 Mac )
ahmed@Ahmeds-MacBook-Pro Week2 CSS & some HTML % node index.js node:internal/modules/cjs/loader:936 throw err; ^
Error: Cannot find module '/Users/ahmed/WebDevCourse/Week2 CSS & some HTML/index.js' at Function.Module._resolveFilename >(node:internal/modules/cjs/loader:933:15) at Function.Module._load (node:internal/modules/cjs/loader:778:27) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) at node:internal/main/run_main_module:17:47 { code: 'MODULE_NOT_FOUND', requireStack: [] }
Node.js v17.2.0
Share Improve this question asked Jan 5, 2022 at 15:04 MrAhmed AlhamedMrAhmed Alhamed 2332 gold badges4 silver badges9 bronze badges 1-
Error: Cannot find module
maybe you have yourindex.js
in another folder? – Martín JF Commented Jan 5, 2022 at 15:12
3 Answers
Reset to default 1I was getting this error when trying to run $node test.js
node:internal/modules/cjs/loader:936
I put this into the same directory as my test.js file.
npm install --save @polkadot/api
this worked for me on Ubuntu.
There are a number of possible causes for this problem, but in my case it was because the parent directory containing my React app was named in the format Next&ReactApps
. The presence of the &
caused npm
to not be able to navigate into the React app's root directory and therefore was throwing these Cannot find module
errors.
To fix this, make sure to remove the &
from the names of any directories in the path to your applications.
To fix that use the mand "yarn add all" in node.js it would install all prefrence using modules
本文标签: javascriptnodeinternalmodulescjsloader936 throw err Stack Overflow
版权声明:本文标题:javascript - node:internalmodulescjsloader:936 throw err; ^ - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744602214a2615136.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论