Home > Net >  Trying to install Prettier on VSCode
Trying to install Prettier on VSCode

Time:08-25

I'm learning JavaScript with "Morten Rand-Hendriksen" on LinkedIn Learning. And the instructor said we need to install "Prettier" on our VSCode. He said that after installing it from the "Extensions" in VSCode, we will open the exercise folder on VSCode and type in the terminal npm install but when I do so this message appears.

PS C:\Users\ytrip\OneDrive\Desktop\javascript-essential-training-2832077-main> npm install
node:internal/modules/cjs/loader:364
      const err = new Error(
                  ^

Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\node_modules\are-we-there-yet\node_modules\readable-stream\readable.js'. Please verify that the package.json has a valid "main" entry
    at tryPackage (node:internal/modules/cjs/loader:364:19)
    at Function.Module._findPath (node:internal/modules/cjs/loader:577:18)
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:942:27)
    at Function.Module._load (node:internal/modules/cjs/loader:804:27)
    at Module.require (node:internal/modules/cjs/loader:1028:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\are-we-there-yet\lib\tracker-stream.js:3:14)
    at Module._compile (node:internal/modules/cjs/loader:1126:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
    at Module.load (node:internal/modules/cjs/loader:1004:32) {
  code: 'MODULE_NOT_FOUND',
  path: 'C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\are-we-there-yet\\node_modules\\readable-stream\\package.json',   
  requestPath: 'readable-stream'
}
node:internal/modules/cjs/loader:364
      const err = new Error(
                  ^

Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\node_modules\are-we-there-yet\node_modules\readable-stream\readable.js'. Please verify that the package.json has a valid "main" entry
    at tryPackage (node:internal/modules/cjs/loader:364:19)
    at Function.Module._findPath (node:internal/modules/cjs/loader:577:18)
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:942:27)
    at Function.Module._load (node:internal/modules/cjs/loader:804:27)
    at Module.require (node:internal/modules/cjs/loader:1028:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\are-we-there-yet\lib\tracker-stream.js:3:14)
    at Module._compile (node:internal/modules/cjs/loader:1126:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
    at Module.load (node:internal/modules/cjs/loader:1004:32) {
  code: 'MODULE_NOT_FOUND',
  path: 'C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\are-we-there-yet\\node_modules\\readable-stream\\package.json',   
  requestPath: 'readable-stream'
}

I'm new in this field and I really couldn't find a solution for this problem. So I'd appreciate your help. And unfortunately, no help is being provided in the discussion forum on LinkedIn Learning.

package.json:

{
  "name": "javascript-essential-training-exercise-files",
  "version": "1.0.0",
  "description": "Repository for exercise files used in the LinkedIn Learning course `JavaScript Essential Training` instructed by Morten Rand-Hendriksen and published 2020.",
  "main": "index.html",
  "author": "Morten Rand-Hendriksen",
  "license": "SEE LICENSE IN LICENSE",
  "devDependencies": {
    "eslint": "^7.11.0",
    "eslint-config-standard": "^14.1.1",
    "eslint-plugin-import": "^2.22.0",
    "eslint-plugin-node": "^11.1.0",
    "eslint-plugin-promise": "^4.2.1",
    "eslint-plugin-standard": "^4.0.1",
    "prettier": "^2.1.2"
  }
}

The repository for this exercise folder is here if anyone want to have a look.

CodePudding user response:

You can check in this reference. I think your problem same with this, you can read and try this solution : Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\bin\node_modules\npm\bin\npm-cli.js' when trying to run npm

Hope you can solve your problem.

CodePudding user response:

Did you try to remove your node_modules folder In some case it works

  • Related