因此,最近我一直在和DocPad玩耍。我已经完成了本教程,并安装了所有内容并正常工作,除了...
为了了解DocPad如何与更大的站点一起工作,我从github上获取了Jason Young(http://ytechie.com)站点的代码(为什么要使用此站点?这是我第一次听说DocPad的全部内容)。按照说明,我执行了npm install
(没有问题);然后docpad run
。它返回此错误:
C:\Users\harnerd\Documents\GitHub\ytechie-docpad>docpad run
error: undefined 'C:\\Users\\harnerd\\.docpad.cson'
error: null
error: null
TypeError: undefined is not a function
at Object.exports.eval (C:\Users\harnerd\Documents\GitHub\ytechie- docpad\node_modules\coffee-script\lib\coffee-script\coffee-script.js:120:47)
at Object.CSON.parseSync (C:\Users\harnerd\Documents\GitHub\ytechie-docpad\node_modules\docpad\node_modules\cson\out\lib\cson.js:90:34)
at null._onTimeout (C:\Users\harnerd\Documents\GitHub\ytechie-docpad\node_modules\docpad\node_modules\cson\out\lib\cson.js:70:24)
at Timer.listOnTimeout (timers.js:119:15)
info: null
鉴于我是DocPad的新手,可能缺少一些简单明了的东西,但我不知道要做什么。我必须承认,出问题时DocPad有点难以理解。在我看来,它在抱怨找不到.docpad.cson文件,但在错误消息中引用的位置中确实存在该文件。
我是完全误解了此错误的含义,还是什么?我在Windows 7上运行node.js v0.12.7和docpad v6.54.2。
编辑:这是我的.docpad.cson文件的内容:
name: "MAC 6a85329428c35b394e921ec0cb3298eed2a1b707"
email: null
username: "6a85329428c35b394e921ec0cb3298eed2a1b707"
subscribed: false
subscribeTryAgain: null
tos: true
identified: true
这里没什么神奇的。在balupton的建议下,我通过coffeescript“ Try CoffeeScript”编译器运行了它,但是毫不奇怪,它只是生成了一些JSON。
编辑2:在本杰明的评论中尝试本人的建议,我运行了
npm install -g docpad
,该成功运行。然后,我在项目内运行了docpad update --global
并获得了以下奖励:C:\Users\harnerd\Documents\GitHub\ytechie-docpad>docpad update --global
info: Welcome to DocPad v6.78.3 (global installation: C:\Users\harnerd\AppData\Roaming\npm\node_modules\docpad)
notice: If everyone who saw this message donated $1/week, maintaining DocPad would become sustainable: http://docpad.org/donate
info: Contribute: http://docpad.org/docs/contribute
info: Plugins: cleanurls, coffeescript, dateurls, eco, less, livereload, marked, paged, partials, sitemap, tagging
info: Environment: development
info: Cleaning files
info: Cleaned files
\
> [email protected] preinstall C:\Users\harnerd\Documents\GitHub\ytechie- docpad\node_modules\docpad-plugin- sitemap\node_modules\extendr\node_modules\typechecker
> node ./cyclic.js
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "docpad@6" "docpad-p
lugin-marked@2" "docpad-plugin-eco@2" "docpad-plugin-less@2" "docpad-plugin- partials@2" "docpad-plugin-coffeescript@2" "docpad-plugin-sitemap@2" "--save"
npm ERR! node v0.12.7
npm ERR! npm v2.11.3
npm ERR! path C:\Users\harnerd\Documents\GitHub\ytechie- docpad\node_modules\docpad-plugin-partials
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! Error: EPERM, lstat 'C:\Users\harnerd\Documents\GitHub\ytechie- docpad\node_modules\docpad-plugin-partials'
npm ERR! at Error (native)
npm ERR! { [Error: EPERM, lstat 'C:\Users\harnerd\Documents\GitHub\ytechie- docpad\node_modules\docpad-plugin-partials']
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! path: 'C:\\Users\\harnerd\\Documents\\GitHub\\ytechie- docpad\\node_modules\\docpad-plugin-partials' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\harnerd\Documents\GitHub\ytechie-docpad\npm-debug.log
error: The action completed successfully
error: An error occured:
Error: Command exited with a non-zero status code.
at Object.safeps.prepareExecutableResult (C:\Users\harnerd\AppData\Roaming\npm\node_modules\docpad\node_modules\safeps\ou t\lib\safeps.js:190:24)
at ChildProcess.<anonymous> (C:\Users\harnerd\AppData\Roaming\npm\node_modules\docpad\node_modules\safeps\ou t\lib\safeps.js:322:29)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
To report the above, follow the guide at: http://docpad.org/bug-report
Error: Command exited with a non-zero status code.
at Object.safeps.prepareExecutableResult (C:\Users\harnerd\AppData\Roaming\npm\node_modules\docpad\node_modules\safeps\ou t\lib\safeps.js:190:24)
at ChildProcess.<anonymous> (C:\Users\harnerd\AppData\Roaming\npm\node_modules\docpad\node_modules\safeps\ou t\lib\safeps.js:322:29)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
C:\Users\harnerd\Documents\GitHub\ytechie-docpad>
尽管有npm的要求,但我还是以管理员身份运行;但是,真正的问题不是npm没有对docpad-plugin-partials文件夹的权限-因为它已被删除,所以根本找不到它。
当我最初在项目上运行
npm install
时,在node_modules文件夹中创建了package.json中列出的所有依赖项,但是随后当我运行docpad update --global
时,删除了docpad-plugin-partials文件夹。为了查看是否可以重复此行为,我又两次获取了该站点的原始代码。每次我运行
npm install
(没问题-所有依赖项在node_modules中都有自己的文件夹),然后运行docpad run
(。docpad.cson文件遇到相同的问题),最后运行docpad update --global
。相关性文件夹已从node_modules文件夹中删除,但从未相同。编辑3:传奇继续。尽管绝对没有任何更改,但是执行
docpad update --global
时文件丢失并保持丢失的奇怪问题已经消失,我又回到了原来的问题(error: undefined 'C:\\Users\\harnerd\\.docpad.cson
)。不知道我的本地环境是否出现问题,或者我抓到的body of code中是否存在错误。我怀疑是后者。 最佳答案
似乎解析该文件存在问题,因为undefined is not a function
发生在CSON的eval语句中。不幸的是,似乎此错误在加载语言环境文件之前发生,这可以解释日志中缺少良好信息的情况,这可能是一个单独的错误(归档报告here)。C:\\Users\\harnerd\\.docpad.cson
中是否有任何函数调用,或者CoffeeScript会解释为函数的某些错误格式?也许通过http://coffeescript.org“ Try CoffeeScript”编译器运行它来进行检查会有所帮助吗?否则,由于该文件中可能包含敏感令牌,您可以通过电子邮件将其发送至[email protected],我来看一下。