Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm can't find package.json

I'm trying to install the dependencies of some example: npm's express 2.5.8 that I've downloaded, but all of the apps throw the same error:

c:\node\stylus>npm install -d npm info it worked if it ends with ok npm info using [email protected] npm info using [email protected] npm ERR! Couldn't read dependencies.  npm ERR! Error: ENOENT, no such file or directory 'c:\node\stylus\package.json' npm ERR! You may report this log at: npm ERR!     <http://github.com/isaacs/npm/issues> npm ERR! or email it to: npm ERR!     <[email protected]> npm ERR! npm ERR! System Windows_NT 6.1.7600 npm ERR! command "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program File s (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-d" npm ERR! cwd c:\node\stylus npm ERR! node -v v0.6.11 npm ERR! npm -v 1.1.1 npm ERR! path c:\node\stylus\package.json npm ERR! code ENOENT npm ERR! message ENOENT, no such file or directory 'c:\node\stylus\package.json'  npm ERR! errno {} npm ERR! npm ERR! Additional logging details can be found in: npm ERR!     c:\node\stylus\npm-debug.log npm not ok 

The blockage appears to be:

no such file or directory 'c:\node\stylus\package.json

Did I miss a step that creates the package.json ?

I'm running:

  • Windows 7 64 bit
  • npm 1.1.1
  • node 6.11
  • express 2.5.8
like image 861
imjp Avatar asked Feb 28 '12 15:02

imjp


2 Answers

I think, npm init will create your missing package.json file. It works for me for the same case.

like image 177
Deepali Agarwal Avatar answered Sep 24 '22 05:09

Deepali Agarwal


Update 2021

npm init 

Please refer to Deepali's answer for details.

Original Outdated Answer

I think you forgot to setup the directory for express:

express <yourdirectory> 

Once you do that you should be able to see a bunch of files, you should then run the command:

npm install -d 

Regards.

like image 44
Aldo Avatar answered Sep 21 '22 05:09

Aldo