Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm install not creating node_modules folder

I am just trying to run npm install . in a local directory, and keep getting these errors:

npm ERR! install Couldn't read dependencies
npm ERR! Darwin 15.2.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "."
npm ERR! node v4.4.6
npm ERR! npm  v2.15.5
npm ERR! code EISDIR
npm ERR! errno -21
npm ERR! syscall read

npm ERR! eisdir EISDIR: illegal operation on a directory, read
npm ERR! eisdir This is most likely not a problem with npm itself
npm ERR! eisdir and is related to npm not being able to find a     package.json in
npm ERR! eisdir a package you are trying to install.

All I'm doing is cd'ing into my directory and running npm install . I have a packages.json file in there, as well. Any idea why this isn't working??? EDIT: contents of packages.json file is below:

{
  "name": "speech-recognition",
 "version": "1.0.0",
 "description": "speech recognition app",
 "main": "application.js",
 "scripts": {
   "test": "echo \"Error: no test specified\" && exit 1",
   "start": "node server.js"
 },
 "author": "Lisa Buch",
 "license": "ISC"
 }
like image 564
tx291 Avatar asked Jun 27 '16 06:06

tx291


1 Answers

Please check your current directory. It should contain a package.json file with proper structure and dependencies.

https://docs.npmjs.com/files/package.json

If you don't have a package.json file, means you are creating a project from scratch. In this case you can create package.json file using following command.

npm init

and install the packages with providing the package name with npm install command. e.g. if you want to install express package. use the following command

npm install express --save

Here --save option will update you package.json file with the package and its version.

like image 137
Abhishek Avatar answered Oct 10 '22 13:10

Abhishek