Does this error mean that node modules cant be found? - node.js

I think I've seen this error on my local computer when I'm missing a module, but I am trying to start my code with pm2. Is that what the error is seen here?
0|my-ba | at Object.<anonymous> (/home/user/website/index.js:4:1)
0|my-ba | at Module._compile (internal/modules/cjs/loader.js:1133:30)
0|my-ba | at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
0|my-ba | at Module.load (internal/modules/cjs/loader.js:977:32)
0|my-ba | at Function.Module._load (internal/modules/cjs/loader.js:877:14)
0|my-ba | at Object.<anonymous> (/usr/lib/node_modules/pm2/lib/ProcessContainerFork.js:32:23)
0|my-ba | at Module._compile (internal/modules/cjs/loader.js:1133:30)
0|my-ba | at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
0|my-ba | at Module.load (internal/modules/cjs/loader.js:977:32)
0|my-ba | at Function.Module._load (internal/modules/cjs/loader.js:877:14)
0|my-ba | at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
0|my-ba | at internal/main/run_main_module.js:18:47 {
0|my-ba | code: 'MODULE_NOT_FOUND',
0|my-ba | requireStack: [ '/home/user/website/index.js' ]
0|my-ba | }

It says it doesn't know how to "start" your app, as it's not in home/user/website/index.js
You need to edit your package.json and see which is the start command and move your files accordingly (or edit, whichever is more convenient)

Related

How to fix the problem when running"npx task createFieldSources"?

I follow the instructions in https://github.com/iden3/rapidsnark to complile the code.
When I try to run "npx task createFieldSources" in my ubuntu in wsl, I get the following errors:
superduper#DESKTOP-PC181T0:/mnt/d/github/4.prove_verify/circuits$ npm install
added 1 package, and audited 2 packages in 3s
found 0 vulnerabilities
superduper#DESKTOP-PC181T0:/mnt/d/github/4.prove_verify/circuits$ git submodule init
superduper#DESKTOP-PC181T0:/mnt/d/github/4.prove_verify/circuits$ git submodule update
superduper#DESKTOP-PC181T0:/mnt/d/github/4.prove_verify/circuits$ npx task createFieldSources
Error: Cannot find module './uws_linux_108'
Require stack:
- /home/superduper/.npm/_npx/366785b987801bcc/node_modules/hub.js/dist/index.js
- /home/superduper/.npm/_npx/366785b987801bcc/node_modules/task/src/index.js
- /home/superduper/.npm/_npx/366785b987801bcc/node_modules/task/bin/cmd.js
at Module._resolveFilename (node:internal/modules/cjs/loader:995:15)
at Module._load (node:internal/modules/cjs/loader:841:27)
at Module.require (node:internal/modules/cjs/loader:1061:19)
at require (node:internal/modules/cjs/helpers:103:18)
at /home/superduper/.npm/_npx/366785b987801bcc/node_modules/hub.js/dist/index.js:239:14
at Object.<anonymous> (/home/superduper/.npm/_npx/366785b987801bcc/node_modules/hub.js/dist/index.js:244:3)
at Module._compile (node:internal/modules/cjs/loader:1159:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
at Module.load (node:internal/modules/cjs/loader:1037:32)
at Module._load (node:internal/modules/cjs/loader:878:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/home/superduper/.npm/_npx/366785b987801bcc/node_modules/hub.js/dist/index.js',
'/home/superduper/.npm/_npx/366785b987801bcc/node_modules/task/src/index.js',
'/home/superduper/.npm/_npx/366785b987801bcc/node_modules/task/bin/cmd.js'
]
}
/home/superduper/.npm/_npx/366785b987801bcc/node_modules/hub.js/dist/index.js:246
$197449592_native.setNoop($197449592_noop)
^
TypeError: Cannot read properties of undefined (reading 'setNoop')
at Object.<anonymous> (/home/superduper/.npm/_npx/366785b987801bcc/node_modules/hub.js/dist/index.js:246:19)
at Module._compile (node:internal/modules/cjs/loader:1159:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
at Module.load (node:internal/modules/cjs/loader:1037:32)
at Module._load (node:internal/modules/cjs/loader:878:12)
at Module.require (node:internal/modules/cjs/loader:1061:19)
at require (node:internal/modules/cjs/helpers:103:18)
at Object.<anonymous> (/home/superduper/.npm/_npx/366785b987801bcc/node_modules/task/src/index.js:1:11)
at Module._compile (node:internal/modules/cjs/loader:1159:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
Node.js v18.12.1
How could I fix them?

Getting error while running npm-check-updates

I am getting below error while trying to execute below command
npm-check-updates
internal/modules/cjs/loader.js:905
throw err;
^
Error: Cannot find module '../../package.json'
Require stack:
C:\Users\hbarsainya\AppData\Roaming\npm\node_modules\npm-check-updates\build\src\bin\cli.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
at Function.Module._load (internal/modules/cjs/loader.js:746:27)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:92:18)
at Object. (C:\Users\hbarsainya\AppData\Roaming\npm\node_modules\npm-check-updates\build\src\bin\cli.js:11:40)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\Users\hbarsainya\AppData\Roaming\npm\node_modules\npm-check-updates\build\src\bin\cli.js'
]
}
I see the location C:\Users\hbarsainya\AppData\Roaming\npm\node_modules\npm-check-updates\build\src\bin\cli.js exist. Can you help me solving this error?
I found the workaround in location https://github.com/raineorshine/npm-check-updates/issues/990
I changed "../../package.json" to "../../../package.json" in /home/ledsun/.local/share/nvm/v17.0.1/lib/node_modules/npm-check-updates/build/src/bin/cli.js:11, then the ncu runs expected.

Unexpected token * exception when run by pm2

I get the following exception when trying to start a node process over pm2 - when I execute the app.js directly everything is working just fine. I see that in the stack trace there is the node_modules folder of pm2 mentioned - why is that?
30|MyPm2Process | /smprod/dev-backend/node_modules/tedious/lib/token/stream-parser.js:60
30|MyPm2Process | static async *parseTokens(iterable, debug, options, colMetadata = []) {
30|MyPm2Process | ^
30|MyPm2Process | SyntaxError: Unexpected token *
30|MyPm2Process | at createScript (vm.js:80:10)
30|MyPm2Process | at Object.runInThisContext (vm.js:139:10)
30|MyPm2Process | at Module._compile (module.js:616:28)
30|MyPm2Process | at Object.Module._extensions..js (module.js:663:10)
30|MyPm2Process | at Module.load (module.js:565:32)
30|MyPm2Process | at tryModuleLoad (module.js:505:12)
30|MyPm2Process | at Function.Module._load (module.js:497:3)
30|MyPm2Process | at Module.require (module.js:596:17)
30|MyPm2Process | at Module.Hook._require.Module.require (/usr/local/lib/node_modules/pm2/node_modules/require-in-the-middle/index.js:70:39)
30|MyPm2Process | at require (internal/module.js:11:18)
Node version: 14.16
Update your pm2 to the latest version
Link
Updating pm2 to the latest version as described here fixed the issue immediatelly.

Why sh script generates "SyntaxError: missing ) after argument list"

I'm trying to run: "npm run test" on Node.js.
OS: Win10.
Getting error:
node_modules\.bin\wdio:2
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
^^^^^^^
SyntaxError: missing ) after argument list
at wrapSafe (internal/modules/cjs/loader.js:1054:16)
at Module._compile (internal/modules/cjs/loader.js:1102:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
at Module.load (internal/modules/cjs/loader.js:986:32)
at Function.Module._load (internal/modules/cjs/loader.js:879:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47

Error: Failed to load gRPC binary module because it was not installed for the current system when trying to run from a docker container

Error: Failed to load gRPC binary module because it was not installed for the current system
api_1 | Expected directory: node-v72-linux-x64-musl
api_1 | Found: [node-v64-linux-x64-glibc, node-v72-linux-x64-glibc, node-v83-linux-x64-glibc]
api_1 | This problem can often be fixed by running "npm rebuild" on the current system
api_1 | Original error: Cannot find module '/usr/src/app/node_modules/grpc/src/node/extension_binary/node-v72-linux-x64-musl/grpc_node.node'
api_1 | Require stack:
api_1 | - /usr/src/app/node_modules/grpc/src/grpc_extension.js
api_1 | - /usr/src/app/node_modules/grpc/src/client_interceptors.js
api_1 | - /usr/src/app/node_modules/grpc/src/client.js
api_1 | - /usr/src/app/node_modules/grpc/index.js
api_1 | - /usr/src/app/middleware/license.js
api_1 | - /usr/src/app/app.js
api_1 | at Object.<anonymous> (/usr/src/app/node_modules/grpc/src/grpc_extension.js:53:17)
api_1 | at Module._compile (internal/modules/cjs/loader.js:1015:30)
api_1 | at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
api_1 | at Module.load (internal/modules/cjs/loader.js:879:32)
api_1 | at Function.Module._load (internal/modules/cjs/loader.js:724:14)
api_1 | at Module.require (internal/modules/cjs/loader.js:903:19)
api_1 | at require (internal/modules/cjs/helpers.js:74:18)
api_1 | at Object.<anonymous> (/usr/src/app/node_modules/grpc/src/client_interceptors.js:144:12)
api_1 | at Module._compile (internal/modules/cjs/loader.js:1015:30)
api_1 | at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
api_1 | at Module.load (internal/modules/cjs/loader.js:879:32)
api_1 | at Function.Module._load (internal/modules/cjs/loader.js:724:14)
api_1 | at Module.require (internal/modules/cjs/loader.js:903:19)
api_1 | at require (internal/modules/cjs/helpers.js:74:18)
api_1 | at Object.<anonymous> (/usr/src/app/node_modules/grpc/src/client.js:35:27)
api_1 | at Module._compile (internal/modules/cjs/loader.js:1015:30) {
api_1 | code: 'MODULE_NOT_FOUND'
api_1 | }
i am trying to run from inside a docker container i tried changing the node version but still cant solve it i tried node v 12 and 14
had the same problem, this fixed it
npm install --target=12.0.0 --target_platform=linux --target_arch=x64 --target_libc=musl

Resources