假设我需要在生产模式下运行才能这样做。我注意到对于 docpad 上的静态部署,您只需上传 out 目录的内容。如果我们使用节点服务器,我们是否会上传整个项目目录。我确实尝试过,但我认为我的 docpad.coffee 设置不正确。你可以在下面看到我的尝试。
docpad.coffee
# ----------------
# Server Configuration
# Server Express
# ----------------
# The express.js instance that we want DocPad to use
# If not set, we will create our own
serverExpress: default
# ----------------
# Port
# ----------------
# Use to change the port that DocPad listens to
# By default we will detect the appropriate port number for our environment
# if no environment port number is detected we will use 9778 as the port number
# Checked environment variables are:
# - PORT - Heroku, Nodejitsu, Custom
# - VCAP_APP_PORT - AppFog
# - VMC_APP_PORT - CloudFoundry
port: - PORT
根据模数站点的第一步是使用环境变量 PORT。app.listen(process.env.PORT)我认为这意味着将其添加- PORT
到docpad.coffee文件中。
同样,我什至不确定上传时如何让网站在生产环境中运行,请记住我只是上传整个目录。部署项目后,我是否从终端中的 Modulus 服务器运行命令?
Modulus 还要求在我的 packages.json 文件中提供以下内容。"main": "path/to/custom_main.js"
除了我认为是 docpad.coffee 文件之外,我已经拥有其中的大部分,所以我链接到了它。
包.json
{
"name": "zurb-foundation.docpad",
"version": "0.4.0",
"description": "Zurb Foundation skeleton for DocPad. Simple and flexible HTML, CSS, and Javascript for popular user interface components and interactions.",
"homepage": "https://github.com/axyz/zurb-foundation.docpad",
"keywords": [
"docpad-skeleton",
"docpad",
"website",
"foundation",
"zurb foundation"
],
"author": "Andrea Moretti <axyzxp@gmail.com>",
"maintainers": [
"Andrea Moretti <axyzxp@gmail.com>"
],
"contributors": [
"Andrea Moretti <axyzxp@gmail.com>"
],
"bugs": {
"url": "https://github.com/axyz/zurb-foundation.docpad/issues"
},
"repository": {
"type": "git",
"url": "http://github.com/axyz/zurb-foundation.docpad.git"
},
"engines": {
"node": "0.10",
"npm": "1.3"
},
"main": "docpad.coffee",
"dependencies": {
"docpad": "~6.54.1",
"docpad-plugin-eco": "~2.0.2",
"docpad-plugin-livereload": "~2.5.3",
"docpad-plugin-coffeescript": "~2.2.2",
"express" : "2.5.x",
"ejs" : "0.8.x",
"docpad-plugin-nodesass": "~2.1.1"
},
"main": "node_modules/docpad/bin/docpad-server",
"scripts": {
"start": "node_modules/docpad/bin/docpad-server"
},
"devDependencies": {}
}
当我部署该站点时,它根本不起作用,我的意思是我有一个链接,但该站点不起作用。关于将 docpad 站点部署到 Modulus 时应该做什么的任何建议?在安装 docpad 后,我也使用了 Sass 的骨架 Foundation,它在本地工作。
好的,仍然试图让这个东西工作,当我运行该站点时,它现在可以在本地工作,当我部署它时,我得到一个指向不起作用的模数子域的链接。我去检查了模数站点上的日志,这就是我得到的
模数日志
...
docpad-plugin-coffeescript@2.2.2 node_modules/docpad-plugin-coffeescript
└── coffee-script@1.6.3
docpad-plugin-eco@2.0.2 node_modules/docpad-plugin-eco
└── eco@1.1.0-rc-3 (strscan@1.0.1, coffee-script@1.6.3)
express@2.5.11 node_modules/express
├── qs@0.4.2
├── mime@1.2.4
├── mkdirp@0.3.0
└── connect@1.9.2 (formidable@1.0.14)
docpad-plugin-livereload@2.5.3 node_modules/docpad-plugin-livereload
├── extendr@2.1.0 (typechecker@2.0.8)
├── primus@1.4.4 (extendable@0.0.6, load@1.0.0)
└── ws@0.4.31 (tinycolor@0.0.1, options@0.0.5, commander@0.6.1, nan@0.3.2)
docpad@6.54.4 node_modules/docpad
├── lazy-require@1.0.0
├── eachr@2.0.2
├── extendr@2.1.0
├── extract-opts@2.2.0
├── caterpillar-filter@2.0.3
├── envfile@1.0.0
├── getmac@1.0.6
├── commander@2.0.0
├── ambi@2.1.6
├── typechecker@2.0.8
├── taskgroup@3.3.0
├── mime@1.2.11
├── query-engine@1.5.3
├── bal-util@2.3.2
├── safefs@3.0.3 (taskgroup@3.2.4)
├── semver@2.2.1
├── safeps@2.2.8 (taskgroup@3.2.4)
├── caterpillar-human@2.1.1 (ansistyles@0.1.1, ansicolors@0.2.1)
├── progressbar@1.0.3 (progress@1.1.2)
├── event-emitter-grouped@2.3.1 (taskgroup@3.2.4)
├── watchr@2.4.4 (taskgroup@3.2.4)
├── promptly@0.2.0 (read@1.0.5)
├── backbone@1.1.0 (underscore@1.5.2)
├── jschardet@1.1.0
├── superagent@0.15.7 (methods@0.0.1, cookiejar@1.3.0, debug@0.7.3, qs@0.6.5, emitter-component@1.0.0, reduce-component@1.0.1, mime@1.2.5, formidable@1.0.14)
├── lodash@2.2.1
├── cson@1.4.5 (requirefresh@1.1.2, coffee-script@1.6.3, js2coffee@0.2.3)
├── caterpillar@2.0.6 (readable-stream@1.1.9)
├── encoding@0.1.7 (iconv-lite@0.2.11)
├── yamljs@0.1.4 (glob@3.1.21, argparse@0.1.15)
└── express@3.4.4 (methods@0.1.0, range-parser@0.0.4, cookie-signature@1.0.1, fresh@0.2.0, debug@0.7.3, buffer-crc32@0.2.1, cookie@0.1.0, send@0.1.4, mkdirp@0.3.5, commander@1.3.2, connect@2.11.0)
docpad-plugin-nodesass@2.1.1 node_modules/docpad-plugin-nodesass
├── node-neat@1.0.0
├── node-bourbon@1.0.0
├── taskgroup@3.2.4 (ambi@2.1.6)
└── node-sass@0.7.0 (node-watch@0.3.4, colors@0.6.0-1, mkdirp@0.3.5, optimist@0.6.0, mocha@1.13.0)
INFO: Main file specified in package.json: node_modules/docpad/bin/docpad-server
INFO: Starting application.
[32minfo:[39m Welcome to DocPad v6.54.4 (global installation: /mnt/data/2/node_modules/docpad)
[32minfo:[39m Contribute: http://docpad.org/docs/contribute
[32minfo:[39m Plugins:
[32minfo:[39m Environment: production
[32minfo:[39m DocPad listening to http://localhost:8080/ on directory /mnt/data/2/node_modules/docpad/bin/out
[32minfo:[39m Generating...
[33mnotice:[39m DocPad is currently running without any plugins installed. You probably want to install some: http://docpad.org/plugins
Error: Cannot generate website as the src dir was not found
at /mnt/data/2/node_modules/docpad/out/lib/docpad.js:3102:21
at /mnt/data/2/node_modules/docpad/node_modules/safefs/out/lib/safefs.js:185:16
at Object.cb [as oncomplete] (fs.js:168:19)
[2013-11-03T17:19:32.095Z] Application initialized with pid 69363
整个日志文件可以在这里看到https://gist.github.com/kitsondevelopment/7292623
它说它找不到 src 目录但是根据这个屏幕截图源目录在那里所以我不明白。
更新
我刚刚注意到它指的是 node_modules/docpad 目录中的 src 目录的错误,我创建的应用程序docpad run
在 node_modules/docpad 中没有 src 目录。为什么会这样?