nodejs / node

Node.js JavaScript runtime ✨🐢🚀✨
https://nodejs.org
Other
108.1k stars 29.86k forks source link

Error [ERR_INTERNAL_ASSERTION]: Code: ERR_MODULE_NOT_FOUND; The provided arguments length (2) does not match the required ones (3). #55395

Closed InfiniteLoopAlchemist closed 1 month ago

InfiniteLoopAlchemist commented 1 month ago

Version

v22.9.0

Platform

Darwin JohnsMacStudio 24.0.0 Darwin Kernel Version 24.0.0: Tue Sep 24 23:39:07 PDT 2024; root:xnu-11215.1.12~1/RELEASE_ARM64_T6000 arm64

Subsystem

No response

What steps will reproduce the bug?

run Make and then try to run the app gives error below

How often does it reproduce? Is there a required condition?

everytime

What is the expected behavior? Why is that the expected behavior?

the app runs with no errors

What do you see instead?

Uncaught Exception: Error [ERR_INTERNAL_ASSERTION]: Code: ERR_MODULE_NOT_FOUND; The provided arguments length (2) does not match the required ones (3). This is caused by either a bug in Node.js or incorrect usage of Node.js internals. Please open an issue with this stack trace at https://github.com/nodejs/node/issues

at assert (node:internal/assert:14:11) at getMessage (node:internal/errors:594:5) at new NodeError (node:internal/errors:471:20) at legacyMainResolve (node:internal/modules/esm/resolve:221:9) at packageResolve (node:internal/modules/esm/resolve:848:14) at moduleResolve (node:internal/modules/esm/resolve:934:18) at defaultResolve (node:internal/modules/esm/resolve:1176:11) at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:542:12) at ModuleLoader.resolve (node:internal/modules/esm/loader:510:25) at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:239:38)

Additional information

No response

InfiniteLoopAlchemist commented 1 month ago

I got the app working again for me by deleting the node modules folder and package-lock

RedYetiDev commented 1 month ago

@InfiniteLoopAlchemist can you provide some more information, such as a reproducible script?

I'm trying to find the offending line, but it maps to https://github.com/nodejs/node/blob/4631be0311fbde7b77723757e15d025727399e63/lib/internal/modules/esm/resolve.js#L221

RedYetiDev commented 1 month ago

I got the app working again for me by deleting the node modules folder and package-lock

That's great, but an internal assertion was thrown, so it'd be best to find out where and how to fix it

InfiniteLoopAlchemist commented 1 month ago

@RedYetiDev reproducible script its happen like twice before but not sure what to give you? after it builds I get these warns (node:56905) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake. (Use node --trace-deprecation ... to show where the warning was created) (node:56905) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake. (node:56905) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake. (node:56905) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake. (node:56905) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake. (node:56905) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake. (node:56905) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake. (node:56905) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake. (node:56905) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake. (node:56905) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake. (node:56905) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake. (node:56905) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake. (node:56905) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake. and aI always know it will error because it does not build the native modules and anything after. but does try to make the app. I know those warns are not coming from my code but electrons former and maybe other packages.

RedYetiDev commented 1 month ago

@nodejs/loaders I'm really not sure where this error would even be thrown, ERR_MODULE_NOT_FOUND doesn't seem to every take less than 3 arguments.

aduh95 commented 1 month ago

It'd be useful to know which version of Node.js is running the code, because clearly it's not 22.9.0 given https://github.com/nodejs/node/issues/55395#issuecomment-2414497400

InfiniteLoopAlchemist commented 1 month ago

thats what node - v told me I was using? { "name": "hideout-weather", "productName": "Hideout Weather", "type": "module", "version": "0.0.1", "description": "hideout weather desktop widget", "main": ".vite/build/main.mjs", "forge": { "packagerConfig": { "icon": "src/assets/icons/Hideout-Weather-icon", "extraResources": [ { "from": "src/assets/icons", "to": "../../assets/icons", "filter": [ "*/" ] } ] } }, "scripts": { "start": "electron-forge --trace-deprecation .", "dev": "electron-forge start", "build": "electron-forge package", "make": "electron-forge make", "publish": "electron-forge publish", "clearNode": "rm -rf node_modules package-lock.json", "clearBuild": "rm -rf out", "lint": "echo \"No linting configured\"" }, "devDependencies": { "@electron-forge/cli": "^7.4.0", "@electron-forge/maker-deb": "^7.4.0", "@electron-forge/maker-rpm": "^7.4.0", "@electron-forge/maker-squirrel": "^7.4.0", "@electron-forge/maker-zip": "^7.4.0", "@electron-forge/plugin-auto-unpack-natives": "^7.4.0", "@electron-forge/plugin-fuses": "^7.4.0", "@electron-forge/plugin-vite": "^7.4.0", "@electron/fuses": "^1.8.0", "autoprefixer": "^10.4.20", "electron": "^32.0.2", "eslint": "^9.11.1", "eslint-plugin-react": "^7.37.0", "postcss": "^8.4.41", "tailwindcss": "^3.4.10", "vite": "^5.0.12" }, "keywords": [], "author": { "name": "InfLoopAlchemist", "email": "InfLoopAlchemist@gmail.com" }, "license": "MIT", "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e", "dependencies": { "astronomy-engine": "^2.1.19", "axios": "^1.7.7", "cacheable": "^1.8.0", "cron": "^3.1.7", "dotenv": "^16.4.5", "electron-extension-installer": "^1.2.0", "electron-squirrel-startup": "^1.0.1", "electron-store": "^10.0.0", "luxon": "^3.5.0", "moment-timezone": "^0.5.45", "prop-types": "^15.8.1", "react": "^18.3.1", "react-color": "^2.19.3", "react-dom": "^18.3.1", "react-icons": "^5.3.0", "react-router-dom": "^6.26.1", "react-tooltip": "^5.28.0", "suncalc": "^1.9.0", "tailwind-scrollbar": "^3.1.0", "tz-lookup": "^6.1.25", "uuid": "^10.0.0", "zips": "^1.1.3" } } infloopalchemist@JohnsMacStudio hideout-weather % node -v
v22.9.0 infloopalchemist@JohnsMacStudio hideout-weather %

just wondering why thats not correct?

RedYetiDev commented 1 month ago

just wondering why thats not correct?

at new NodeError (node:internal/errors:471:20) at legacyMainResolve (node:internal/modules/esm/resolve:221:9)

The source code of v22.9.0 does not map a error thrown from legacyMainResolve at line 221, so it likely that whatever Node.js processor threw the error wasn't running v22.9.0.

Additionally, No release lines' latest version map up with where the error was thrown, so it's likely that if this was once an issue, it is no longer one.

RedYetiDev commented 1 month ago

The error was likely thrown from v16, an outdated version of Node.js. I'm closing this issue because of that.

https://github.com/nodejs/node/blob/76f9a7d27f5ae9852b9ffc67a7dec1af503e0813/lib/internal/modules/esm/resolve.js#L242-L243

This is pretty close to what OP described (from v16.x)

aduh95 commented 1 month ago

just wondering why thats not correct?

Likely electron-forge has some version of Node.js bundled which is different from the one installes globally in your system

InfiniteLoopAlchemist commented 1 month ago

so any way to fix that or is it normal? @aduh95

InfiniteLoopAlchemist commented 1 month ago

@RedYetiDev 20.17.0 after adding a console.log(process.versions.node); in main.mjs

RedYetiDev commented 1 month ago

Regardless of the version (btw it can't be v20.17.0), this issue is specific to previous (EoL) version of Node.js (Seems to be <=v16.x), and will not be looked into, as these versions are not being maintained.

InfiniteLoopAlchemist commented 1 month ago

Are you saying dont worry about it? because clearing node modules and "npm update" fixed it? or is there something I have to do? so this does not happen anymore?

RedYetiDev commented 1 month ago

I'm saying that whatever caused it used an unsupported version of Node.js, so it can't be "fixed" (see the comment below). If you found a workaround, use that as a "fix".

aduh95 commented 1 month ago

By ‘it can't be "fixed"’, RedYetiDev means ‘Node.js won't release a patch version for that release line‘ (obviously a fix is technically still possible, but it won't be merged nor investigated in this repo). Upgrading the version of Node.js being used (which seems to have happened since you're now reporting 20.x) is certainly the best workaround.