javascript - Npm searching for package.json in the wrong directory - Stack Overflow

Hey I'm trying to install webpack right now.I have everything setup, but when I try to run webpack

Hey I'm trying to install webpack right now.

I have everything setup, but when I try to run webpack inside my terminal, it searches for the package.json file in the wrong directory.

So my question is, can I change the path where npm tries to find my package.json file?

npm ERR! enoent ENOENT: no such file or directory, open '/home/User/package.json

^error message I get after trying to run npm webpack in Terminal

{
  "name": "package",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "babel-core": "^6.26.0",
    "babel-loader": "^7.1.2",
    "babel-preset-es2015": "^6.24.1",
    "babel-preset-react": "^6.24.1",
    "es6-promise": "^4.1.1",
    "react": "^16.2.0",
    "react-dom": "^16.2.0"
  }
}

^this is the package.json file from my project

Hey I'm trying to install webpack right now.

I have everything setup, but when I try to run webpack inside my terminal, it searches for the package.json file in the wrong directory.

So my question is, can I change the path where npm tries to find my package.json file?

npm ERR! enoent ENOENT: no such file or directory, open '/home/User/package.json

^error message I get after trying to run npm webpack in Terminal

{
  "name": "package",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "babel-core": "^6.26.0",
    "babel-loader": "^7.1.2",
    "babel-preset-es2015": "^6.24.1",
    "babel-preset-react": "^6.24.1",
    "es6-promise": "^4.1.1",
    "react": "^16.2.0",
    "react-dom": "^16.2.0"
  }
}

^this is the package.json file from my project

Share Improve this question edited Dec 26, 2017 at 4:34 KARTHIKEYAN.A 20.2k10 gold badges137 silver badges150 bronze badges asked Dec 24, 2017 at 15:42 SupEldrixSupEldrix 1131 silver badge8 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 5

You are in the wrong directory.

Make sure you are in the right folder and then run npm install webpack.

In your terminal use pwd to print the current working directory and then ls to list all the files inside it. If there is no package.json you can't install anything.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744297138a4567315.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信