Why do I get this error while running "npm start"? - visual-studio-code

I want to write some e2e tests for one app and when I run "npm start" I receive the following error message:
enter image description here
C:\Users\saros.LAPTOP-JQTANCVI\OneDrive\Documents\CypressWithTypescript\trelloapp-master\index.js:5
const server = jsonServer.create();
^
TypeError: jsonServer.create is not a function
at Object. (C:\Users\saros.LAPTOP-JQTANCVI\OneDrive\Documents\CypressWithTypescript\trelloapp-master\index.js:5:27)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159: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
PS C:\Users\saros.LAPTOP-JQTANCVI\OneDrive\Documents\CypressWithTypescript\trelloapp-master>
Can somebody explain to me step-by-step how can I fix this issue?
Thank you!

Related

Unable to run realm-cli on mac m1, return node:internal/child_process

When I try to run realm-cli I get node:internal/child_process everytime, no matter what i do.
I tried reinstalling, using different node version, previous mongodb-realm-cli version, same error.
I'm on new Mac M1, using zsh and nvm
$ realm-cli whoami
node:internal/child_process:413
throw errnoException(err, 'spawn');
^
Error: spawn Unknown system error -86
at ChildProcess.spawn (node:internal/child_process:413:11)
at spawn (node:child_process:700:9)
at Object.<anonymous> (/Users/me/.nvm/versions/node/v17.9.0/lib/node_modules/mongodb-realm-cli/wrapper.js:22:22)
at Module._compile (node:internal/modules/cjs/loader:1099:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:975: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 {
errno: -86,
code: 'Unknown system error -86',
syscall: 'spawn'
}
Node.js v17.9.0

Module not found and the code given has no solution

asalam,.good morning dev..
im looking for solution how to fix my hashlip art engine.below is the code mention,
SyntaxError: Unexpected token ','
at Object.compileFunction (node:vm:352:18)
at wrapSafe (node:internal/modules/cjs/loader:1031:15)
at Module._compile (node:internal/modules/cjs/loader:1065:27)
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 Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object. (C:\Users\asus 21.6.21\OneDrive\Desktop\hashlips_art_engine-1.1.2_patch_v1\index.js:2:39)
at Module._compile (node:internal/modules/cjs/loader:1101:14)

!MODULE NOT FOUND" When running node index.js w/npm

I've borrowed a code off Github, but when I try to run the code, this error comes up:
Error: Cannot find module 'C:\Users\Ihate\Desktop\hashlips_art_engine/node_modules/sha1'
- C:\Users\Ihate\Desktop\hashlips_art_engine\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 Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (C:\Users\Ihate\Desktop\hashlips_art_engine\src\main.js:4:14)
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 Module.require (node:internal/modules/cjs/loader:1005:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\Ihate\\Desktop\\hashlips_art_engine\\src\\main.js',
'C:\\Users\\Ihate\\Desktop\\hashlips_art_engine\\index.js'
]
I don't quite understand this error even after an hour or so of research. I can confirm that those two files do exist in the correct location.
Please ask questions if this isn't clear or if you need information, I'll try to get back to you as soon as I can.

How can I solve this yeoman generator code error

I tried installing code-generator to create my own syntax highlighting in vscode. However, when I tried running code with yo code, this happened :
yo code
/usr/local/lib/node_modules/yo/node_modules/yeoman-environment/lib/resolver.js:70
filePatterns: lookups.flatMap(prefix => [`${prefix}/*/index.ts`, `${prefix}/*/index.js`, `${prefix}/*/index.cjs`, `${prefix}/*/index.mjs`]),
^
TypeError: lookups.flatMap is not a function
at Environment.resolver.lookup (/usr/local/lib/node_modules/yo/node_modules/yeoman-environment/lib/resolver.js:70:27)
at init (/usr/local/lib/node_modules/yo/lib/cli.js:130:7)
at pre (/usr/local/lib/node_modules/yo/lib/cli.js:89:3)
at Object.<anonymous> (/usr/local/lib/node_modules/yo/lib/cli.js:219:3)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
Do you have any idea how I can fix it ?
Try updating NPM. That fixed it for me anyway.

visual studio code SyntaxError: Unexpected identifier with node . discord bot coding

I am new to coding when I try to run this command
var commando = require("discord.js-commando");
var yourbot = new commando.client();
yourbot.login('MzI1MDI2MzQ4NzEwMjMyMDY2.DCSP8Q.Xyn-k0_DfnV4x3WsKtfDPBM0KfU');
and then I type node . I get this
SyntaxError: Unexpected identifier
at Object.exports.runInThisContext (vm.js:78:16)
at Module._compile (module.js:543:28)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/Users/myusername/Desktop/Cyborg Pasta/node_modules/discord.js-commando/src/index.js:4:10)
at Module._compile (module.js:571:32)
Ians-MBP:Cyborg Pasta iankalman$ node .
/Users/iankalman/Desktop/Cyborg Pasta/node_modules/discord.js-commando/src/client.js:144
async setProvider(provider) {
^^^^^^^^^^^`
delete your node_modules folder and try reinstalling your modules with npm. Also, never post your bot token online you need to revoke that token.