javascript - npm 错误!无关的 : pug@2. 0.0-alpha6

标签 javascript json node.js express coffeescript

我需要一些帮助。我刚刚学习使用 Node.js 构建网站。 我已经安装了 Node v4.5.0、npm 2.15.9、coffeescript 1.10.0 我正在遵循“CoffeeScript and Node.js”一书中的说明。 我有这个文件package.json:

{
    "name": "todo",
    "version": "0.0.1",
    "private": true,
    "scripts": {
        "start": "node app"
    },
    "dependencies": {
        "express": "3.0.0beta6",
        "jade": "*",
        "socket.io": "*",
        "coffee-script": "*",
        "connect-assets": "*"
    }
}

我运行了命令:npm install,之后显示了一些警告,有关 jade 已被弃用,并且必须安装 pug。 我已将 package.json 文件中的 jade 更改为 pug,然后再次运行 npm install。再次出现一些关于较新版本的 pug 的警告!又修改了一下,终于出现这个ERR了! 我希望得到一些帮助,以及如何继续。

注意:示例代码来自一本相当老的书(2012 年),并且从未更新 我应该如何进行?我有一个包含 jade pug 的目录树。那行得通吗?或者我应该更新 node 和/或 npm

编辑:我现在已经完成了大部分工作,但又出现了另一个问题。应该和之前的有关系吧? 问题:我安装了另一个帮助模块:npm installsupervisor-g。当我运行 Supervisor app.coffee 时,一开始一切看起来都正常,但在对其中一个文件进行更改后,控制台显示变得疯狂。我必须阻止它,结果是这样的:

Starting child process with 'coffee.cmd app.coffee'
Listening on port 3000
events.js:141
      throw er; // Unhandled 'error' event
      ^

Error: listen EADDRINUSE :::3000
  at Object.exports._errnoException (util.js:907:11)
  at exports._exceptionWithHostPort (util.js:930:20)
  at Server._listen2 (net.js:1250:14)
  at listen (net.js:1286:10)
  at Server.listen (net.js:1382:5)
  at Function.app.listen (C:\Examples\todo_node\todo\node_modules\express\lib\application.js:533:24)
  at Object.<anonymous> (C:\Examples\todo_node\todo\app.coffee:13:5)
  at Object.<anonymous> (C:\Examples\todo_node\todo\app.coffee:1:1)
  at Module._compile (module.js:409:26)
  at Object.exports.run (C:\Users\ad\AppData\Roaming\npm\node_modules\coffee-script\lib\coffee-script\coffee-script.js:134:23)
  at compileScript (C:\Users\ad\AppData\Roaming\npm\node_modules\coffee-script\lib\coffee-script\command.js:224:29)
  at compilePath (C:\Users\ad\AppData\Roaming\npm\node_modules\coffee-script\lib\coffee-script\command.js:174:14)
  at Object.exports.run (C:\Users\ad\AppData\Roaming\npm\node_modules\coffee-script\lib\coffee-script\command.js:98:20)
  at Object.<anonymous> (C:\Users\ad\AppData\Roaming\npm\node_modules\coffee-script\bin\coffee:7:41)
  at Module._compile (module.js:409:26)
  at Object.Module._extensions..js (module.js:416:10)
  at Module.load (module.js:343:32)
  at Function.Module._load (module.js:300:12)
  at Function.Module.runMain (module.js:441:10)
  at startup (node.js:139:18)
  at node.js:974:3

 Program coffee.cmd app.coffee exited with code 1

Starting child process with 'coffee.cmd app.coffee'
Received SIGINT, killing child process...
Parent process exiting, terminating child...

第二次编辑;我读到 Error: Listen EADDRINUSE:::3000 表明 3000 地址正在使用中。我不知道什么可能会使用它,但我想知道如何避免这种情况。我在 Windows 10 上运行这个应用程序,今天刚刚更新。 而且,我使用命令 coffee app.coffee 运行应用程序没有任何问题。缺点是每次文件更改时都必须关闭并重新启动。

我希望有人能进一步帮助我,

谢谢你, 广告

最佳答案

Jade 是 Pug 模板引擎的旧名称。
使用 Pug,最新版本是 2.0.0-b6 : Pug page on NPM

您可以在浏览器中的页面上尝试。
如果 NPM 失败,请尝试 GitHub repository

如果您对版本不满意,只需使用:

npm install pug --save

自动将 Pug 添加到您的 package.json 中(使用正确的最新版本)。

编辑:您有哪些警告/错误?可以发一下吗?
编辑 2:您的 Express 版本也已过时。

关于javascript - npm 错误!无关的 : pug@2. 0.0-alpha6,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39507816/

相关文章:

node.js - 尝试连接到 nodejs 中的 postgresql 池时如何修复 ECONNREFUSED 错误

json - JSON 中的链式州城市下拉列表

javascript - 在 Gatsbyjs 中将 csv 文件转换为 json

node.js - 用于多项选择题和答案的 MongoDB 模式设计

javascript - Nodejs异步 waterfall 使用外部所需的javascript文件中的函数

javascript - AngularJS - 按钮 - 在依赖之前调用函数或指令

javascript - 向 Canvas 中绘制的对象添加大小控制柄

javascript - 如何使用 KnockoutJs Binding 在 moment.js 中将日期转换为其他格式?

javascript - Dynamics 365 中的错误 "Cannot set property ' eventManager' of null"

javascript - 我使用了 HTML + JAVAScript,但我只能看到 JAVAScript