I am facing issue to run the JavaScript file in VS code.
I am getting the output as:-
[Running] node "e:\n\Temporay folders of web development\vs code project\tut64.js"
node:internal/fs/utils:343
throw err;
^
Error: ENOENT: no such file or directory, open 'tut64.txt'
at Object.openSync (node:fs:582:3)
at Object.readFileSync (node:fs:450:35)
at Object.<anonymous> (e:\n\Temporay folders of web development\vs code project\tut64.js:2:17)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:79:12)
at node:internal/main/run_main_module:17:47 {
errno: -4058,
syscall: 'open',
code: 'ENOENT',
path: 'tut64.txt'
}
[Done] exited with code=1 in 0.839 seconds
And in the terminal I am getting:-
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
PS E:\n\Temporay folders of web development\vs code project> node \tut64.js\
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module 'E:\tut64.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:79:12)
at node:internal/main/run_main_module:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
I am not getting what type of these errors are and why I am getting them.
In the terminal you should do node tut64.js
And check the path of tut64.txt or post your code.
Related
It's my firt time using node today and I was faced with this issue. When trying to run hello.js in my terminal, I get this error :
Error: Cannot find module '/Users/antoinelafonta/hello.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:77:12)
at node:internal/main/run_main_module:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
It's running fine when using the VsCode terminal.
Any ideas ?
Thanks !
Error message:
[nodemon] starting `babel-node index.js`
C:\Users\Zara Gunner\AppData\Roaming\npm\node_modules\babel-cli\node_modules\babel-core\lib\transformation\file\options\option-manager.js:328
throw e;
^
Error: Requires Babel "^7.0.0-0", but was loaded with "6.26.3". If you are sure you have a compatible version of #babel/core, it is likely that something in your build process is loading the wrong version. Inspect the stack trace of this error to look for the first entry that doesn't mention "#babel/core" or "babel-core" to see what is calling Babel. (While processing preset: "C:\\Users\\Zara Gunner\\FYP\\fourthyearproject\\fourthyearproject\\node_modules\\#babel\\preset-env\\lib\\index.js")
at throwVersionError (C:\Users\Zara Gunner\FYP\fourthyearproject\fourthyearproject\node_modules\#babel\helper-plugin-utils\lib\index.js:78:11) at Object.assertVersion (C:\Users\Zara Gunner\FYP\fourthyearproject\fourthyearproject\node_modules\#babel\helper-plugin-utils\lib\index.js:28:5)
at C:\Users\Zara Gunner\FYP\fourthyearproject\fourthyearproject\node_modules\#babel\preset-env\lib\index.js:251:7
at C:\Users\Zara Gunner\FYP\fourthyearproject\fourthyearproject\node_modules\#babel\helper-plugin-utils\lib\index.js:22:12
at C:\Users\Zara Gunner\AppData\Roaming\npm\node_modules\babel-cli\node_modules\babel-core\lib\transformation\file\options\option-manager.js:317:46
at Array.map (<anonymous>)
at OptionManager.resolvePresets (C:\Users\Zara Gunner\AppData\Roaming\npm\node_modules\babel-cli\node_modules\babel-core\lib\transformation\file\options\option-manager.js:275:20)
at OptionManager.mergePresets (C:\Users\Zara Gunner\AppData\Roaming\npm\node_modules\babel-cli\node_modules\babel-core\lib\transformation\file\options\option-manager.js:264:10)
at OptionManager.mergeOptions (C:\Users\Zara Gunner\AppData\Roaming\npm\node_modules\babel-cli\node_modules\babel-core\lib\transformation\file\options\option-manager.js:249:14)
at OptionManager.init (C:\Users\Zara Gunner\AppData\Roaming\npm\node_modules\babel-cli\node_modules\babel-core\lib\transformation\file\options\option-manager.js:368:12)
at compile (C:\Users\Zara Gunner\AppData\Roaming\npm\node_modules\babel-cli\node_modules\babel-register\lib\node.js:103:45)
at loader (C:\Users\Zara Gunner\AppData\Roaming\npm\node_modules\babel-cli\node_modules\babel-register\lib\node.js:144:14)
at Object.require.extensions.<computed> [as .js] (C:\Users\Zara Gunner\AppData\Roaming\npm\node_modules\babel-cli\node_modules\babel-register\lib\node.js:154:7)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at Object.<anonymous> (C:\Users\Zara Gunner\AppData\Roaming\npm\node_modules\babel-cli\lib\_babel-node.js:154:22)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47 {
code: 'BABEL_VERSION_UNSUPPORTED',
version: '6.26.3',
range: '^7.0.0-0'
}
Whats the problem ??? I'm working on a bot for discord using JavaScript when executing my files in VS code it works normally but in Repl.it it shows me this error
internal/fs/utils.js:269
throw err;
^
Error: ENOENT: no such file or directory, open '/home/runner/Bot/index.js'
at Object.openSync (fs.js:462:3)
at Object.readFileSync (fs.js:364:35)
at Object.<anonymous> (/run_dir/interp.js:195:19)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
at internal/main/run_main_module.js:17:47 {
errno: -2,
syscall: 'open',
code: 'ENOENT',
path: '/home/runner/Bot/index.js'
}
When I start my discord bot I get an error on the console:
internal/modules/cjs/loader.js:834
throw err;
^
Error: Cannot find module 'discord.js'
Require stack:
- /home/container/index.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:831:15)
at Function.Module._load (internal/modules/cjs/loader.js:687:27)
at Module.require (internal/modules/cjs/loader.js:903:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/home/container/index.js:1:17)
at Module._compile (internal/modules/cjs/loader.js:1015:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
at Module.load (internal/modules/cjs/loader.js:879:32)
at Function.Module._load (internal/modules/cjs/loader.js:724:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [ '/home/container/index.js' ]
}
But if there is an "index.js"
You need to install discord.js, in your console type npm install discord.js
I am using node.js to run one app given by my professor on my chrome. Something wrong happen, but I don't know because I am a rookie.
The structure is as follows:
/app
/models
answers.js
questions.js
sessions.js
user.js
passport.js
qmanage.js
routes.js
/config
auth.js
database.js
mcd.js
package.json
/public
some css png fonts jpg document
qloader.js
server.js
/views
some ejs document
At first, it shows this problem:
module.js:457
throw err;
^
Error: Cannot find module 'mongoose'
at Function.Module._resolveFilename (module.js:455:15)
at Function.Module._load (module.js:403:25)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/Users/shen/Desktop/os/cse303.p2/server.js:2:16)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
then, based on this help Node.js error Error: Cannot find module 'mongoose' I run npm install mongoose in my root path of project. Then I have those error below:
dyn143030:cse shen$ node server.js
{ Error: Cannot find module '../build/Release/bson'
at Function.Module._resolveFilename (module.js:455:15)
at Function.Module._load (module.js:403:25)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/Users/shen/Desktop/os/cse303.p2/node_modules/bson/ext/index.js:15:10)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3) code: 'MODULE_NOT_FOUND' }
js-bson: Failed to load c++ bson extension, using pure JS version
events.js:160
throw er; // Unhandled 'error' event
^
Error: Invalid mongodb uri. Missing hostname
at muri (/Users/shen/Desktop/os/cse303.p2/node_modules/muri/lib/index.js:40:11)
at NativeConnection.Connection.open (/Users/shen/Desktop/os/cse303.p2/node_modules/mongoose/lib/connection.js:195:16)
at Mongoose.connect (/Users/shen/Desktop/os/cse303.p2/node_modules/mongoose/lib/index.js:212:15)
at Object.<anonymous> (/Users/shen/Desktop/os/cse303.p2/server.js:4:10)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
at Module.runMain (module.js:590:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:509:3
I tried to find solution from this help
Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' } js-bson: Failed to load c++ bson extension, using pure JS version
but it seems not my case, because I am using OS X 10.11.3
dyn143030:cse shen$ node -v
v6.5.0
dyn143030:cse shen$ npm -v
3.10.3
From my aspect, I think the system find bson someplace wrong, so how to modify it? Thanks! If any more information is need, please tell me.
I find in node_modules\bson\ext\index.js
and change path on 10th line
bson = require('../build/Release/bson'); to bson = require('bson');
You can try adding mongoose to the dependency list in the package.json file, or also doing >npm install mongoose in the project folder.