Error: Cannot find module '../package.json' Node v20.2.0 #4751
Replies: 0 comments 3 replies
-
n your project's folder, you need to initialize the package.json file by running the following in the terminal: After that, you should be able to install any packages as you would expect, like express: Shout out to Deepali's answer. |
Beta Was this translation helpful? Give feedback.
-
Verify Node.js Installation: Ensure that Node.js is correctly installed on your system. Open a terminal or command prompt and run the following commands to check the versions of Node.js and npm: Run this command Clear npm cache: Sometimes, issues can arise due to a corrupted npm cache. Run the following command to clear the npm cache: If nothing is working, try the following ways:
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Version
v20.2.0
Platform
Microsoft Windows NT 10.0.19045.0 x64
Subsystem
No response
What steps will reproduce the bug?
I Run
npm i -g
How often does it reproduce? Is there a required condition?
Always it reproduces
What is the expected behavior? Why is that the expected behavior?
Npm installs electron and mineflayer
What do you see instead?
D:\lol>npm i
Debugger attached.
Waiting for the debugger to disconnect...
node:internal/process/promises:289
triggerUncaughtException(err, true /* fromPromise */);
^
Error: Cannot find module './package.json'
Require stack:
at Module._resolveFilename (node:internal/modules/cjs/loader:1070:15)
at Module._load (node:internal/modules/cjs/loader:923:27)
at Module.require (node:internal/modules/cjs/loader:1137:19)
at require (node:internal/modules/helpers:121:18)
at module.exports (C:\Users\MIDHUN\AppData\Roaming\npm\node_modules\npm\lib\cli.js:17:17)
at Object. (C:\Users\MIDHUN\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js:2:25)
at Module._compile (node:internal/modules/cjs/loader:1255:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1309:10)
at Module.load (node:internal/modules/cjs/loader:1113:32)
at Module._load (node:internal/modules/cjs/loader:960:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\Users\MIDHUN\AppData\Roaming\npm\node_modules\npm\lib\cli.js',
'C:\Users\MIDHUN\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js'
]
}
Node.js v20.2.0
Additional information
No response
Beta Was this translation helpful? Give feedback.
All reactions