So, I've been playing around with DocPad lately; I've run through the tutorial and have everything installed and working properly, except...
In the interest of seeing how DocPad works with a larger site, I grabbed the code for Jason Young's (http://ytechie.com) site from github (why this site? It's where I first heard about DocPad is all). Per the instructions, I executed npm install (no problems yet); then docpad run. It returns with this error:
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
Given that I'm new to DocPad, there's probably something simple and obvious that I'm missing, but I've no idea what. I must admit that DocPad is a bit inscrutable when something goes wrong. It seems to me that it's complaining that it can't find the .docpad.cson file, but it definitely does exist in the location referenced in the error message.
Am I totally misinterpreting the meaning of this error, or what? I'm running node.js v0.12.7 and docpad v6.54.2 on Windows 7.
Edit: Here are the contents of my .docpad.cson file:
name: "MAC 6a85329428c35b394e921ec0cb3298eed2a1b707"
email: null
username: "6a85329428c35b394e921ec0cb3298eed2a1b707"
subscribed: false
subscribeTryAgain: null
tos: true
identified: true
Nothing magical here. At balupton's suggestion, I ran it through the coffeescript "Try CoffeeScript" compiler, but unsurprisingly it simply generated some JSON.
Edit 2: Trying Benjamin's suggestion in his comment, I ran npm install -g docpad, which ran successfully. I then ran docpad update --global inside the project and was rewarded with this:
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>
Despite npm's claim, I was running as administrator; however the real problem was not that npm didn't have permission to the docpad-plugin-partials folder - it simply couldn't find it as it had been deleted.
When I originally ran npm install on the project, all the dependencies listed in package.json were created in the node_modules folder, but then when I ran docpad update --global the docpad-plugin-partials folder was removed.
To see if I could repeat this behavior, I grabbed the original code for the site two more times. Each time I ran npm install (no problems - all the dependencies have their own folders in node_modules), then docpad run (got the same problem with the .docpad.cson file), and then finally docpad update --global. Dependency folders were removed from the node_modules folder, but never the same ones.
Edit 3: The saga continues. Despite absolutely nothing having changed, the odd problem with files going missing and staying missing when executing docpad update --global is gone and I'm back to the original problem (error: undefined 'C:\\Users\\harnerd\\.docpad.cson). Don't know if something in my local environment is borked or if there's something wrong in the body of code I grabbed. I doubt it's the latter.
It seems that there was an issue parsing that file, as the
undefined is not a functionoccurred within an eval statement of CSON. Unfortunately, it seems this error occurred before the locale file was loaded, which would explain the lack of good information in the log, which would be a seperate bug (filed report here).Are there any function calls inside
C:\\Users\\harnerd\\.docpad.csonor perhaps some incorrect formatting that CoffeeScript would interpret as a function? Perhaps running it through the http://coffeescript.org "Try CoffeeScript" compiler to check would be helpful? Otherwise, as that file may have sensitive tokens in it, could you email it to [email protected] and I'll take a look.