docpad运行错误未定义.docpad.cson

所以最近我一直在玩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有点难以理解。 在我看来,这是抱怨,它无法find.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的build议中,我通过咖啡脚本“Try CoffeeScript”编译器运行它,但毫不奇怪,它只是产生了一些JSON。

编辑2:在他的评论尝试本杰明的build议,我跑了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 \ > typechecker@2.0.8 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> 

尽pipenpm的说法,我以pipe理员身份运行; 然而,真正的问题不是npm没有docpad-plugin-partials文件夹的权限 – 它根本找不到它,因为它已被删除。

当我最初在项目上运行npm install时,package.json中列出的所有依赖项都创build在node_modules文件夹中,但是当我运行docpad update --global ,docpad-plugin-partials文件夹被删除。

为了看看我是否可以重复这种行为,我再次抓取了网站的原始代码两次。 每次我运行npm install (没有问题 – 所有的依赖都在node_modules中有自己的文件夹),然后docpad run (和.docpad.cson文件一样),最后docpad update --global 。 相关文件夹已从node_modules文件夹中删除,但从不相同。

编辑3:传奇继续。 尽pipe没有任何改变,文件丢失,并在执行docpad update --global时保持丢失奇怪的问题 – docpad update --global已经没有了,我回到了原来的问题( error: undefined 'C:\\Users\\harnerd\\.docpad.cson )。 不知道在我的本地环境中是否有什么东西存在,或者我抓取的代码的内容是否有问题。 我怀疑这是后者。

似乎有parsing该文件的问题,因为undefined is not a function在CSON的eval语句中发生的函数。 不幸的是,似乎这个错误发生在locale文件被加载之前,这将解释在日志中缺乏好信息,这将是一个单独的错误( 在这里提交报告)。

C:\\Users\\harnerd\\.docpad.cson是否有任何函数调用,或者可能是某些不正确的格式,CoffeeScript会将其解释为函数? 也许运行它通过http://coffeescript.org “Try CoffeeScript”编译器检查将是有帮助的? 否则,由于该文件可能具有敏感的令牌,您可以通过电子邮件发送到support@docpad.org,我会看看。