8

I've been trying to install a package that I have defined the package.json for. The package.json file is very simple.

{
  "name": "project",
  "version": "0.0.1",
  "devDependencies": {
    "karma-jasmine": "0.2.2"
  }
}

Now when I issue a

npm install .

I get the following error.

npm WARN package.json [email protected] No repository field.
npm ERR! addLocal Could not install /Users/username/projects/project
npm ERR! Darwin 14.0.0
npm ERR! argv "node" "/usr/local/bin/npm" "install" "."
npm ERR! node v0.10.32
npm ERR! npm  v2.1.5
npm ERR! code EISDIR
npm ERR! errno 28

npm ERR! EISDIR, read
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <http://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/username/projects/project/npm-debug.log

Unable to understand what am I doing wrong.

2 Answers 2

9

After spending a lot of time on this I finally figured out the cause. I didn't have a package.json file but I had it misspelt as packages.json file.

NPM wasn't able to pick up the file from the current directory and then it tried my home directory and then showed the unhelpful error. I hope this will help somebody save some time.

6

Top Tip - once you have created your new project's github repository and cloned it locally, issue the command :

npm init    

which will prompt you for particulars and auto synthesize a file

package.json

for you

UPDATE : I see its been fixed ... my current version has a much better error message :

npm install
npm WARN ENOENT ENOENT: no such file or directory, open '/home/scott/aaa/package.json'


node --version
v5.4.1

npm --version
3.3.12
2
  • This is a great tip for that workflow but once your file is gone and you issue npm install the error message is so cryptic that I think the solution mentioning that you are missing the file or have misspelt is more valuable.
    – toomasr
    Oct 28, 2014 at 8:11
  • the crew over at npm are very responsive - I strongly suggest U book them an Issue at their github.com/npm/npm so we all benefit from their/our fix (hopefully) Oct 28, 2014 at 17:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.