nx.js using capacitor Cannot find module 'nx/src/utils/app-root' - capacitor

In my NX project, I have a capacitor Angular 14 application, when using cap:sync, I get the following error which stomps me.
> nx run caregiver:sync:ios --verbose=true
> NX Cannot find module 'nx/src/utils/app-root'
Require stack:
- /Users/yannickdesjardins/Documents/GitHub/nx-c4g/nx-c4g/node_modules/#nxtend/capacitor/node_modules/#nrwl/devkit/index.js
- /Users/yannickdesjardins/Documents/GitHub/nx-c4g/nx-c4g/node_modules/#nxtend/capacitor/src/executors/cap/executor.js
- /Users/yannickdesjardins/Documents/GitHub/nx-c4g/nx-c4g/node_modules/nx/src/config/workspaces.js
- /Users/yannickdesjardins/Documents/GitHub/nx-c4g/nx-c4g/node_modules/nx/src/command-line/run.js
- /Users/yannickdesjardins/Documents/GitHub/nx-c4g/nx-c4g/node_modules/nx/bin/run-executor.js
Error: Cannot find module 'nx/src/utils/app-root'
Require stack:
- /Users/yannickdesjardins/Documents/GitHub/nx-c4g/nx-c4g/node_modules/#nxtend/capacitor/node_modules/#nrwl/devkit/index.js
- /Users/yannickdesjardins/Documents/GitHub/nx-c4g/nx-c4g/node_modules/#nxtend/capacitor/src/executors/cap/executor.js
- /Users/yannickdesjardins/Documents/GitHub/nx-c4g/nx-c4g/node_modules/nx/src/config/workspaces.js
- /Users/yannickdesjardins/Documents/GitHub/nx-c4g/nx-c4g/node_modules/nx/src/command-line/run.js
- /Users/yannickdesjardins/Documents/GitHub/nx-c4g/nx-c4g/node_modules/nx/bin/run-executor.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> (/Users/yannickdesjardins/Documents/GitHub/nx-c4g/nx-c4g/node_modules/#nxtend/capacitor/node_modules/#nrwl/devkit/index.js:182:18)
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 Module.require (node:internal/modules/cjs/loader:1005:19)
My nx report is the following: I use node 16, nx 14 and capacitor 13. I have research on the subject but can't seem to find the right answer.

Related

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.

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.