我正在try 安装一些示例的依赖项:我下载的npm's 快报2.5.8,但所有应用都会抛出相同的错误:

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, 没有这样的文件或目录"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, 没有这样的文件或目录"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
  • node 6.11
  • 快报2.5.8

推荐答案

Update 2021

npm init

详情请参考Deepali's答案.

Original Outdated Answer

我想你忘记设置express的目录了:

express <yourdirectory>

一旦你这样做了,你应该能够看到一堆文件,然后你应该运行命令:

npm install -d

当做

Node.js相关问答推荐

即使DDB键不存在, node Lambda也不会失败,并返回NULL作为结果

在Nest.Js中,如何发送带有表单数据的正文请求并应用正文请求验证.附加的文件是可选的

(0,core_1.default)不是使用@middy/core的lambda处理程序上的函数

是否可以在MongoDB中比较和匹配引用文档中的字段

为什么这个verifyToken函数从未被调用过?

React原生Nodejs兼容性问题

Express Web 服务器部署到 prod 但 GET 返回超时错误

BrowserRouter 无法渲染组件

如何找到特定文档并更新数组中特定键的值?

NodeJS 中的流 API 数据如何流动?

Azure Function 在 2022 年 4 月 26 日禁用将用户字段设置为 HTTP 请求对象

使用中的端口代码:'EADDRINUSE',即使在 kill 命令之后

如何将子集合添加到 Firestore 中的文档?

MongoDB Node findone如何处理没有结果?

如何运行用 TypeScript 编写的 Mocha 测试?

User.findOrCreate 函数是做什么的,什么时候在Passport 中调用它?

使用 pm2 编程 api 重命名进程

npm install 给出警告,npm audit fix 不起作用

Mongoose - 保存字符串数组

使用 Monit 而不是基本的 Upstart 设置有什么好处?