Solving the 'npm WARN saveError ENOENT: no such file or directory, open '/Users//package.json'' error

前端 未结 7 1364
半阙折子戏
半阙折子戏 2020-12-17 08:15

I\'m a newbie so please include links to URLs or explain terminologies so I can understand.

I\'ve managed to install \'npm\' on a Mac OS (10.13.3) via the

7条回答
  •  -上瘾入骨i
    2020-12-17 08:40

    npm WARN saveError ENOENT: no such file or directory, open '/Users/{username}/package.json'

    • You don't have a package.json > use npm init

    • You are in the wrong directory > cd to the folder where your package.json is, like so:

      cd C://Dev/MySolution/MyWebProject and then try again.


    npm WARN media-queries-nikhil@1.0.0 No description

    npm WARN media-queries-nikhil@1.0.0 No repository field.

    Abulifa's answer explains that as your project could be published as it's own npm package. In that scenario, these warnings would help warn that your package.json is missing some fields.

    If you know you'll never publish as an npm package, and want to hide these warnings, add this to your package.json:

    "description": "filling out this field to avoid warnings",
    "repository": "not publishing",
    "readme": "not publishing",
    "license": "not publishing",
    

提交回复
热议问题