user3366804
user3366804

Reputation:

Created a package.json file, but getting dependency errors when running npm install

I know this is a common question and I tried researching on here, but none of the answers have seemed to help me thus far.

I am following this tutorial to learn node, and after I try to install the package.json I received the following errors:

npm ERR! install Couldn't read dependencies
npm ERR! Darwin 14.3.0
npm ERR! argv "node" "/usr/local/bin/npm" "install"
npm ERR! node v0.12.4
npm ERR! npm  v2.10.1
npm ERR! path /Users/salvi/Desktop/nodejs1/package.json
npm ERR! code ENOPACKAGEJSON
npm ERR! errno -2

npm ERR! package.json ENOENT, open '/Users/salvi/Desktop/nodejs1/package.json'
npm ERR! package.json This is most likely not a problem with npm itself.
npm ERR! package.json npm can't find a package.json file in your current directory.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/salvi/Desktop/nodejs1/node_modules/npm-debug.log



// package.json

{
    "name": "node-api",
    "main": "server.js",
    "dependencies": {
        "express": "~4.0.0",
        "mongoose": "~3.6.13",
        "body-parser": "~1.0.1"
    }
}

I know I have node installed because of checking the version, and Im running this command in the terminal in the root of the application. Any help appreciated!

EDIT: I am receiving the following now when I run npm install:

npm install -bash: /usr/local/bin/npm: No such file or directory

https://scotch.io/tutorials/build-a-restful-api-using-node-and-express-4

Upvotes: 0

Views: 823

Answers (1)

stdob--
stdob--

Reputation: 29172

As we can see, there paсkage.json no in the project folder. Create it by running the command npm init in project folder or create your own with a text editor.

Upvotes: 1

Related Questions