docpad run error undefined .docpad.cson

时间:2015-09-05 19:11:16

标签: node.js docpad

所以,我最近一直在玩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
\
> 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>

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

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

为了查看我是否可以重复此行为,我再次抓取该网站的原始代码两次。每次我运行npm install(没有问题 - 所有依赖项在node_modules中都有自己的文件夹),然后docpad run(与.docpad.cson文件有同样的问题),然后最后{{1 }}。从node_modules文件夹中删除了依赖项文件夹,但从不相同。

编辑3:传奇继续。尽管没有任何改变,但是在执行docpad update --global时文件丢失和保持丢失的奇怪问题已经消失,我又回到了原始问题(docpad update --global)。不知道我当地环境中的某些东西是否被堵塞,或者我抓到的body of code是否有什么问题。我怀疑是后者。

1 个答案:

答案 0 :(得分:0)

似乎解析该文件时出现问题,因为undefined is not a function发生在CSON的eval语句中。不幸的是,似乎在加载语言环境文件之前发生了这个错误,这可以解释日志中缺少好的信息,这将是一个单独的错误(提交报告here)。

C:\\Users\\harnerd\\.docpad.cson内是否有任何函数调用,或者可能是CoffeeScript将其解释为函数的一些错误格式?也许是通过http://coffeescript.org&#34;尝试CoffeeScript&#34;编译检查会有帮助吗?否则,由于该文件中可能包含敏感令牌,您可以通过电子邮件将其发送至support@docpad.org,我会查看。

相关问题