我正在尝试在ExpressJS项目中使用browserify / jadeify:
server.coffee
browserify = require "browserify"
jadeify = require "jadeify"
bundle = browserify()
.use(jadeify(__dirname + "/client/jade/templates"))
.addEntry(__dirname + "/public/js/app/main.js")
app.use bundle
main.coffee
(客户端)
$ = require "jquery"
jadeify = require "jadeify"
html = jadeify "test.jade",
title: "Hello World"
console.log html
我得到的是:
Error: require maps no longer supported
at Function.Wrap.require (/labs/Projects/Nodebook/node_modules/browserify/lib/wrap.js:410:15)
at Function.module.exports.Object.keys.forEach.self.(anonymous function) [as require] (/labs/Projects/Nodebook/node_modules/browserify/index.js:158:28)
at module.exports (/labs/Projects/Nodebook/node_modules/jadeify/index.js:53:16)
at Function.Wrap.use (/labs/Projects/Nodebook/node_modules/browserify/lib/wrap.js:105:5)
at Function.module.exports.Object.keys.forEach.self.(anonymous function) [as use] (/labs/Projects/Nodebook/node_modules/browserify/index.js:158:28)
at Object.<anonymous> (/labs/Projects/Nodebook/server.coffee:55:25)
at Object.<anonymous> (/labs/Projects/Nodebook/server.coffee:63:4)
at Module._compile (module.js:449:26)
at Object.exports.run (/usr/lib/node_modules/coffee-script/lib/coffee-script/coffee-script.js:83:25)
at compileScript (/usr/lib/node_modules/coffee-script/lib/coffee-script/command.js:177:29)
似乎服务器不想启动。我如何让它工作?我认为代码与文档中的代码大致相同。什么错了,我该如何解决这个问题?