“Couldn't read dependencies” error with npm

前端 未结 17 2610
别跟我提以往
别跟我提以往 2020-12-23 14:59

I wanted to start a Node app and created a package.json file with a tutorial. Here is the json file:

{
    \"name\": \"Dashboard\",         


        
相关标签:
17条回答
  • 2020-12-23 15:25

    1)Nodejs installs in C:\ProgramFiles in some cases. Try installing in C: drive or another directory if you don't have admin rights.

    2)Make sure you are not installing behind a company's proxy setting. This can sometimes affect installation.

    3) Finally, make sure you run the npm command from this directory: Path\nodejs\node_modules\npm where Path is your own directory.

    0 讨论(0)
  • 2020-12-23 15:26

    I had an "Invalid Name"

    I switched from "name": "Some Name",... to "name": "Some-Name",...

    Guess name needs to be a sluggy string.

    0 讨论(0)
  • 2020-12-23 15:29

    Problem with not reading the json is linked to permission issues with the file.

    Using this command will do the trick:

    sudo chown -R $USER:$GROUP ~/.npm
    

    0 讨论(0)
  • 2020-12-23 15:31

    Recently, I've started to get an error:

    npm ERR! install Couldn't read dependencies
    npm ERR! Error: Invalid version: "1.0"
    

    So, you may need to specify version of your package with 3 numbers, e.g. 1.0.0 instead of 1.0 if you get similar error.

    0 讨论(0)
  • 2020-12-23 15:37

    I figured out I wasn't in the correct folder. I needed goto the folder I just cloned before I ran this command.

    0 讨论(0)
提交回复
热议问题