小编典典

npm找不到package.json

node.js

我正在尝试安装一些示例的依赖项:express 2.5.8我已经下载了npm ,但是所有应用程序都抛出相同的错误:

c:\node\stylus>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:\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!     <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:\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

堵塞似乎是:

没有这样的文件或目录’c:\ node \ stylus \ package.json

我是否错过了创建的步骤package.json

我在run:

  • Windows 7 64位
  • npm 1.1.1
  • node6.11
  • express2.5.8

阅读 523

收藏
2020-07-07

共1个答案

小编典典

更新2018

这已成为一个很受欢迎的问题,我的回答(尽管标记为正确)不再有效。

我认为,npm init将创建您丢失的package.json文件。在相同情况下对我也有效。

npm init

原始过时的答案

我认为您忘记设置快递目录:

express <yourdirectory>

完成后,您应该可以看到一堆文件,然后应该运行以下命令:

npm install -d

问候。

2020-07-07