Welcome to Code Forum!

Join a community that supports you and your coding journey from day one. We strive to be a friendly, supportive community that empowers everyone to be better developers. By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.

    GIF shows where to locate </> in the thread and or post editor toolbar.
    To learn more about how to use our BBCode feature, review our "How to post your code into threads" here.

    Thank you, Code Forum.

Node.JS npm not working any more

merrittr

New Coder
I have my package.json in C:\WebApp\NodeJsApi

C:\WebApp\NodeJsApi>dir package.json Volume in drive C has no label. Volume Serial Number is 9E48-5DDC Directory of C:\WebApp\NodeJsApi 03/10/2023 03:23 PM 551 package.json 1 File(s) 551 bytes 0 Dir(s) 32,664,289,280 bytes free

but when I try to npm list I get the following errors


Code:
C:\WebApp\NodeJsApi>npm list -g --depth=0
node:internal/modules/cjs/loader:1075
  const err = new Error(message);
              ^


Error: Cannot find module '../package.json'
Require stack:
- C:\WebApp\NodeJsApi\node_modules\npm\lib\cli.js
- C:\WebApp\NodeJsApi\node_modules\npm\bin\npm-cli.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1075:15)
    at Module._load (node:internal/modules/cjs/loader:920:27)
    at Module.require (node:internal/modules/cjs/loader:1141:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at createEnginesValidation (C:\WebApp\NodeJsApi\node_modules\npm\lib\cli.js:7:15)
    at module.exports (C:\WebApp\NodeJsApi\node_modules\npm\lib\cli.js:78:27)
    at Object.<anonymous> (C:\WebApp\NodeJsApi\node_modules\npm\bin\npm-cli.js:2:25)
    at Module._compile (node:internal/modules/cjs/loader:1254:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
    at Module.load (node:internal/modules/cjs/loader:1117:32) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\WebApp\\NodeJsApi\\node_modules\\npm\\lib\\cli.js',
    'C:\\WebApp\\NodeJsApi\\node_modules\\npm\\bin\\npm-cli.js'
  ]
}


Node.js v18.15.0
node:internal/modules/cjs/loader:1075
  const err = new Error(message);
              ^


Error: Cannot find module '../package.json'
Require stack:
- C:\WebApp\NodeJsApi\node_modules\npm\lib\cli.js
- C:\WebApp\NodeJsApi\node_modules\npm\bin\npm-cli.js
←[90m    at Module._resolveFilename (node:internal/modules/cjs/loader:1075:15)←[39m
←[90m    at Module._load (node:internal/modules/cjs/loader:920:27)←[39m
←[90m    at Module.require (node:internal/modules/cjs/loader:1141:19)←[39m
←[90m    at require (node:internal/modules/cjs/helpers:110:18)←[39m
    at createEnginesValidation ←[90m(C:\WebApp\NodeJsApi\←[39mnode_modules\←[4mnpm←[24m\lib\cli.js:7:15←[90m)←[39m
    at module.exports ←[90m(C:\WebApp\NodeJsApi\←[39mnode_modules\←[4mnpm←[24m\lib\cli.js:78:27←[90m)←[39m
    at Object.<anonymous> ←[90m(C:\WebApp\NodeJsApi\←[39mnode_modules\←[4mnpm←[24m\bin\npm-cli.js:2:25←[90m)←[39m
←[90m    at Module._compile (node:internal/modules/cjs/loader:1254:14)←[39m
←[90m    at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)←[39m
←[90m    at Module.load (node:internal/modules/cjs/loader:1117:32)←[39m {
  code: ←[32m'MODULE_NOT_FOUND'←[39m,
  requireStack: [
    ←[32m'C:\\WebApp\\NodeJsApi\\node_modules\\npm\\lib\\cli.js'←[39m,
    ←[32m'C:\\WebApp\\NodeJsApi\\node_modules\\npm\\bin\\npm-cli.js'←[39m
  ]
}


Node.js v18.15.0


any idea how I can fix this?
 
Back
Top Bottom