npm WARN install Refusing to install hapi as a dependency of itself

后端 未结 5 1166
傲寒
傲寒 2020-12-14 14:35

I tried to do the following (per instructions from official site):

  • mkdir hapi && cd hapi
  • npm init
  • npm
5条回答
  •  余生分开走
    2020-12-14 15:23

    This was my initial code

    {
      "name": "react",
      "version": "1.0.0",
      "description": "",
      "main": "index.js",
      "scripts": {
        "test": "echo \"Error: no test specified\" && exit 1"
      },
      "author": "",
      "license": "ISC",
      "dependencies": {
        "react": "^15.6.1"
      }
    }
    

    which threw error

    npm WARN package.json react@1.0.0 No description
    npm WARN package.json react@1.0.0 No repository field.
    npm WARN package.json react@1.0.0 No README data
    npm WARN install Refusing to install react as a dependency of itself
    

    then i renamed the name from react to react_app and my code looks like

    {
      "name": "react_app",
      "version": "1.0.0",
      "description": "",
      "main": "index.js",
      "scripts": {
        "test": "echo \"Error: no test specified\" && exit 1"
      },
      "author": "",
      "license": "ISC",
      "dependencies": {
        "react": "^15.6.1"
      }
    }
    

    then it worked

提交回复
热议问题