“Couldn't read dependencies” error with npm

前端 未结 17 2609
别跟我提以往
别跟我提以往 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:20

    I resolved that problem just moving my project from E: to C:. I think it happened becouse nodejs and npm was installed in my C: and the project was in my E:

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

    I ran into this problem after I cloned a git repository to a directory, renamed the directory, then tried to run npm install. I'm not sure what the problem was, but something was bungled. Deleting everything, re-cloning (this time with the correct directory name), and then running npm install resolved my issue.

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

    For me it was the version. Yes, the line you put at the root, like :

    {
        "name": "your-project",
        "version": "0.1"
        ...
    }
    

    Yes, npm doesn't like version like this, it prefers something like "0.0.1".

    Don't ask me why, I'll tell you it's totally stupid (or "how to loose time easily")

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

    Verify user account, you are working on. If any system user has no permissions for installation packages, npm particulary also is showing this message.

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

    My mistake was the I named the file packages.json instead of package.json

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

    This doesn't look like your issue, but for the sake of others, for me this was caused by an invalid version number in package.json (had to change 2.4 to 2.4.0).

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