How can I solve this yeoman generator code error - visual-studio-code

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.

Related

Why do I get this error while running "npm start"?

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!

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.

passport component registration field (MODULE_NOT_FOUND) after mounting loopback 3 inside loopback4

I am trying to upgrade from loopback 3 to loopback 4 using "mounting strategy" according to the documentation.
while trying to run the app using npm start, i am getting the following error:
node -r source-map-support/register .
Cannot start the application. { Error: Cannot find module
'../../node_modules/loopback-component-passport/lib/models/utils.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object. (C:\Data\myComp\app\myapp_docker\services\myapp_auth\lb3app\server\utils\providerUtils.js:2:15)
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 Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object. (C:\Data\myComp\app\myapp_docker\services\fauth\lb3app\server\server.js:6:25)
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) code: 'MODULE_NOT_FOUND' } npm ERR! code ELIFECYCLE npm ERR! errno 1
I checked and i have the module in the node_modules directory and the utils.js file.
I had to search in all my app files for the string "node_modules" and I found that the relative path for that directory was incorrect. had to add one more "../" before the node_modules.

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.