Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
189 views
in Technique[技术] by (71.8m points)

node.js - 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:
odestylus>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:
odestyluspackage.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:
odestylus
npm ERR! node -v v0.6.11
npm ERR! npm -v 1.1.1
npm ERR! path c:
odestyluspackage.json
npm ERR! code ENOENT
npm ERR! message ENOENT, no such file or directory 'c:
odestyluspackage.json'

npm ERR! errno {}
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     c:
odestylus
pm-debug.log
npm not ok

The blockage appears to be:

no such file or directory 'c: odestyluspackage.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
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...