我正在尝试为mobwrite node.js package运行演示。首先我安装了mobwrite软件包(npm install mobwrite
),然后输入以下命令:
node -e "require('mobwrite').quickserve()"
应该启动演示服务器,但会引发以下错误:
module.js:340
throw err;
^
Error: Cannot find module './lib/middleware'
at Function.Module._resolveFilename (module.js:388:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (PATH_TO_MODULES\mobwrite.js:2:18)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at [eval]:1:1
at Object.<anonymous> ([eval]-wrapper:6:22)
at Module._compie (module.js:456:26)
at evalScript (node.js:532:25)
at startup (node.js:80:7)
at node.js:901:3
这来自mobwrite.js文件,其中包需要包含存储在lib文件夹中的中间件文件(middleware.coffee
):
require("coffee-script")
middleware = require("./lib/middleware")
module.exports = middleware
我看过SO上类似帖子的答案,但到目前为止还没有解决我的问题。我怎样才能克服这个错误?
答案 0 :(得分:1)
您可以尝试手动将coffeescript文件编译为javascript:npm install -g coffee-script && coffee -c node_modules/mobwrite/lib/middleware.coffee && coffee -c node_modules/mobwrite/lib/daemon.coffee
。然后重试你的命令。