npm 找不到 package.json [英] npm can't find package.json
本文介绍了npm 找不到 package.json的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试安装一些示例的依赖项:我下载的 npm 的 express 2.5.8
,但所有应用程序都抛出相同的错误:
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 npm@1.1.1
npm info using node@v0.6.11
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! <npm-@googlegroups.com>
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
阻塞似乎是:
没有这样的文件或目录 'c: odestyluspackage.json
no such file or directory 'c: odestyluspackage.json
我是否错过了创建 package.json
的步骤?
Did I miss a step that creates the package.json
?
我正在跑步:
- Windows 7 64 位
- npm 1.1.1
- 节点 6.11
- 表达 2.5.8
推荐答案
2021 年更新
npm init
详情请参考Deepali的回答.
原始过时答案
我想你忘记设置 express 的目录了:
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
问候.
这篇关于npm 找不到 package.json的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文