Problem deploying to Zeit Now - Error: Build was unable to create the distDir: public - deployment

I've been trying to deploy a Gatsby.js blog with a Sanity.io back-end to Now. I started the project using this template (https://github.com/sanity-io/example-company-website-gatsby-sanity-combo), have written a few blog posts and attempted to deploy to Now. I'm hitting an error during deployment:
TaskID a56874b3-6d7f-4ecf-90d1-c5a05f3fe6ea
#zeit/now-dcs-info: using https://dcs.now.systems as the upstream
running yarn info for #now/build-utils...
running yarn info for #now/static-build...
running yarn for #now/build-utils...
yarn add v1.13.0
warning package.json: No license field
info No lockfile found.
warning No license field
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
warning No license field
success Saved 35 new dependencies.
info Direct dependencies
└─ #now/build-utils#0.5.1
info All dependencies
├─ #now/build-utils#0.5.1
├─ async-retry#1.2.3
├─ async-sema#2.1.4
├─ balanced-match#1.0.0
├─ brace-expansion#1.1.11
├─ buffer-crc32#0.2.13
├─ concat-map#0.0.1
├─ core-util-is#1.0.2
├─ double-ended-queue#2.1.0-0
├─ end-of-stream#1.4.1
├─ errno#0.1.7
├─ from2#2.3.0
├─ fs-extra#7.0.0
├─ fs.realpath#1.0.0
├─ glob#7.1.3
├─ graceful-fs#4.1.15
├─ inflight#1.0.6
├─ into-stream#5.0.0
├─ isarray#1.0.0
├─ jsonfile#4.0.0
├─ memory-fs#0.4.1
├─ minimatch#3.0.4
├─ multistream#2.1.1
├─ node-fetch#2.2.0
├─ p-is-promise#2.1.0
├─ path-is-absolute#1.0.1
├─ process-nextick-args#2.0.0
├─ prr#1.0.1
├─ readable-stream#2.3.6
├─ retry#0.12.0
├─ safe-buffer#5.1.2
├─ string_decoder#1.1.1
├─ universalify#0.1.2
├─ util-deprecate#1.0.2
└─ yazl#2.4.3
Done in 1.42s.
running yarn for #now/static-build...
yarn add v1.13.0
warning package.json: No license field
info No lockfile found.
warning No license field
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
warning No license field
success Saved 4 new dependencies.
info Direct dependencies
└─ #now/static-build#0.5.2
info All dependencies
├─ #now/static-build#0.5.2
├─ get-port#5.0.0
├─ promise-timeout#1.3.0
└─ type-fest#0.3.1
Done in 0.67s.
running builder.exports.build...
downloading user files...
installing to /tmp/2b1d07e4/web
running user "now-build" script from `package.json`...
running "npm run now-build"
> example-company-website-gatsby-sanity-combo-frontend#1.0.0 now-build /tmp/2b1d07e4/web
> npm run build
> example-company-website-gatsby-sanity-combo-frontend#1.0.0 build /tmp/2b1d07e4/web
> gatsby build
success open and validate gatsby-configs — 0.011 s
success load plugins — 0.197 s
success onPreInit — 0.516 s
success delete html and css files from previous builds — 0.009 s
success initialize cache — 0.009 s
success copy gatsby files — 0.030 s
warning [sanity] `overlayDrafts` is set to `true`, but no token is given
warning [sanity] Using `watchMode` when not in develop mode might prevent your build from completing
info [sanity] Fetching remote GraphQL schema
info [sanity] Stitching GraphQL schemas from SDL
success onPreBootstrap — 0.398 s
info [sanity] Fetching export stream for dataset
info [sanity] Watch mode enabled, starting a listener
info [sanity] Done exporting!
success source and transform nodes — 0.271 s
success building schema — 1.450 s
info Creating blog post page: /blog/2019/05/coding-a-design-system-part-one/
info Creating blog post page: /blog/2019/05/coding-a-design-system-part-two/
info Creating project page: /project/barclays-design-language/
success createPages — 0.323 s
success createPagesStatefully — 0.055 s
success onPreExtractQueries — 0.016 s
success update schema — 1.154 s
success extract queries from components — 0.298 s
success run graphql queries — 0.162 s — 12/12 74.77 queries/second
success write out page data — 0.004 s
success write out redirect data — 0.001 s
success onPostBootstrap — 0.001 s
info bootstrap finished - 7.409 s
success Building production JavaScript and CSS bundles — 23.259 s
success Building static HTML for pages — 4.967 s — 10/10 30.18 pages/second
info Done building in 35.64 sec
Error: Build was unable to create the distDir: public.
Make sure you mentioned the correct dist directory: https://zeit.co/docs/v2/deployments/official-builders/static-build-now-static-build/#configuring-the-build-output-directory
at validateDistDir (/tmp/utils/build-module/node_modules/#now/static-build/index.js:19:11)
at Object.exports.build (/tmp/utils/build-module/node_modules/#now/static-build/index.js:114:7)
at <anonymous>
at process._tickDomainCallback (internal/process/next_tick.js:228:7)
I think this might be a common issue from other posts I've read but I'm unsure on next steps. Has anyone successfully fixed a similar issue to this that could lend a hand? Thanks

Related

Using Sendgrid with Hydrogen on Vercel

I am developing a Hydrogen (1.6.1) site. I have the #sendgrid/mail (7.7.0) package and I am able to successfully send messages on my local dev environment. However, when I deploy to Vercel, I'm getting the message...
[FAILED] Cannot bundle Node.js built-in "fs" imported from "node_modules/#sendgrid/helpers/classes/attachment.js". Consider disabling ssr.noExternal or remove the built-in dependency.
╭─ error ──────────────────────────────────────────────────────────────────────╮
│ │
│ Cannot bundle Node.js built-in "fs" imported from │
│ "node_modules/#sendgrid/helpers/classes/attachment.js". Consider disabling │
│ ssr.noExternal or remove the built-in dependency. │
│ │
╰──────────────────────────────────────────────────────────────────────────────╯
I have tried disabling ssr.noExternal as suggested, but the app won't build in this configuration. Has anyone been able to deploy under this infrastructure?
We solved it by moving it into a netlify function.

Nuxt 3 SSR deploy on vercel via self hosted gitlab CI

Im trying to deploy nuxt 3 in SSR mode to vercel via self hosted gitlab CI without luck. I follow official vercel example (https://github.com/vercel/examples/tree/main/ci-cd/gitlab-cicd). So in general deploy run these commands:
npm install --global vercel
vercel pull --yes --environment=preview --token=$VERCEL_TOKEN
vercel build --token=$VERCEL_TOKEN
vercel deploy --prebuilt --token=$VERCEL_TOKEN
After everything was set I tried to actually run it and most of process seems ok
$ npm install --global vercel
added 214 packages, and audited 215 packages in 43s
26 packages are looking for funding
run `npm fund` for details
4 moderate severity vulnerabilities
To address all issues (including breaking changes), run:
npm audit fix --force
Run `npm audit` for details.
$ vercel pull --yes --environment=preview --token=$VERCEL_TOKEN
Vercel CLI 28.2.5
Retrieving project…
> Downloading `preview` Environment Variables for Project XXX
Downloading
Created .vercel/.env.preview.local file [564ms]
> Downloading project settings
Downloaded project settings to .vercel/project.json [0ms]
$ vercel build --token=$VERCEL_TOKEN
Vercel CLI 28.2.5
Installing dependencies...
> postinstall
> nuxt prepare
[log] Nuxi 3.0.0-rc.10
[info] [nuxt:tailwindcss] Using default Tailwind CSS file from runtime/tailwind.css
[success] Types generated in .nuxt
added 761 packages in 41s
105 packages are looking for funding
run `npm fund` for details
> build
> nuxt build
[log] Nuxi 3.0.0-rc.10
[log] Nuxt 3.0.0-rc.10 with Nitro 0.5.3
[info] [nuxt:tailwindcss] Using default Tailwind CSS file from runtime/tailwind.css
[warn]
[warn] warn - No utility classes were detected in your source files. If this is unexpected, double-check the `content` option in your Tailwind CSS configuration.
[warn] warn - https://tailwindcss.com/docs/content-configuration
[info] Client built in 5509ms
[info] Building server...
[success] Server built in 2822ms
[success] [nitro] Generated public .output/public
[info] [nitro] Building Nitro Server (preset: `node-server`)
[success] [nitro] Nitro server built
├─ .output/server/package.json (650 B) (287 B gzip)
├─ .output/server/index.mjs (458 B) (257 B gzip)
├─ .output/server/chunks/nitro/node-server.mjs.map (62.8 kB) (4.78 kB gzip)
├─ .output/server/chunks/nitro/node-server.mjs (18.6 kB) (5.87 kB gzip)
├─ .output/server/chunks/handlers/renderer.mjs.map (19.6 kB) (3.39 kB gzip)
├─ .output/server/chunks/handlers/renderer.mjs (15.5 kB) (4.75 kB gzip)
├─ .output/server/chunks/error-500.mjs.map (1.05 kB) (379 B gzip)
├─ .output/server/chunks/error-500.mjs (4.26 kB) (1.83 kB gzip)
├─ .output/server/chunks/app/styles.mjs.map (538 B) (279 B gzip)
├─ .output/server/chunks/app/styles.mjs (5.54 kB) (1.57 kB gzip)
├─ .output/server/chunks/app/server.mjs.map (55.4 kB) (8.16 kB gzip)
├─ .output/server/chunks/app/server.mjs (43.7 kB) (11.2 kB gzip)
├─ .output/server/chunks/app/client.manifest.mjs.map (2.38 kB) (495 B gzip)
├─ .output/server/chunks/app/client.manifest.mjs (3.21 kB) (589 B gzip)
├─ .output/server/chunks/app/_nuxt/index.fcab534d.mjs.map (756 B) (367 B gzip)
├─ .output/server/chunks/app/_nuxt/index.fcab534d.mjs (1.12 kB) (532 B gzip)
├─ .output/server/chunks/app/_nuxt/error-component.5ae4281e.mjs.map (2.34 kB) (801 B gzip)
├─ .output/server/chunks/app/_nuxt/error-component.5ae4281e.mjs (2.01 kB) (894 B gzip)
├─ .output/server/chunks/app/_nuxt/error-500.1731c24b.mjs.map (1.69 kB) (612 B gzip)
├─ .output/server/chunks/app/_nuxt/error-500.1731c24b.mjs (3.17 kB) (1.41 kB gzip)
├─ .output/server/chunks/app/_nuxt/error-500-styles.ad145178.mjs.map (350 B) (222 B gzip)
├─ .output/server/chunks/app/_nuxt/error-500-styles.ad145178.mjs (2.22 kB) (864 B gzip)
├─ .output/server/chunks/app/_nuxt/error-404.2013b5e2.mjs.map (2.35 kB) (798 B gzip)
├─ .output/server/chunks/app/_nuxt/error-404.2013b5e2.mjs (4.03 kB) (1.7 kB gzip)
├─ .output/server/chunks/app/_nuxt/error-404-styles.3db9fdd2.mjs.map (350 B) (223 B gzip)
├─ .output/server/chunks/app/_nuxt/error-404-styles.3db9fdd2.mjs (3.92 kB) (1.25 kB gzip)
├─ .output/server/chunks/app/_nuxt/default.a6850ccd.mjs.map (929 B) (424 B gzip)
└─ .output/server/chunks/app/_nuxt/default.a6850ccd.mjs (1.31 kB) (612 B gzip)
Σ Total size: 3.05 MB (705 kB gzip)
[success] [nitro] You can preview this build using `node .output/server/index.mjs`
Error: No Output Directory named "dist" found after the Build completed. You can configure the Output Directory in your Project Settings.
Learn More: https://vercel.link/missing-public-directory
So it seems that build itself and authentification is ok but the problem is:
Error: No Output Directory named "dist" found after the Build completed. You can configure the Output Directory in your Project Settings.
On first sight it seems like vercel expect generated site and not SSR. I tried to google little bit and I have found vercel-builder which seems to solve this problem (at least for nuxt https://github.com/nuxt/vercel-builder) but i got errors with type script which actually lead me to https://github.com/nuxt/vercel-builder/issues/245 where is info that it should not be used for nuxt 3. To be more specific:
Don't use this with Nuxt 3 - there is a much better, built-in solution for deploying to Vercel!
and link to
https://v3.nuxtjs.org/guide/deploy/providers/vercel
But from official nuxt 3 for vercel provider:
Support for serverless build
Auto-detected when deploying
No configuration required
It seems that it should somehow works out of the box. Weirdest thing is that if I use same commands that i use in gitlab CI from local terminal deploy is successful and everything is fine.
I would be glad for any advice. Im trying to solve this for hours.
override the build command in the project settings in vercel to use nuxt generate.

Keeping Nuget packages updated in many projects/solutions

If using the same nuget package(s) over multiple solutions, how do I keep them up to date without having to open up every solution and update packages when a new version is released?
Folder structure is typically something like this but over many more projects. Each project has its own packages.config with various package references.
$tfs/
├── Solution One/
│ ├ Solution 1.sln
│ ├ nuget.config (solution item)
│ ├── Packages/
│ ├ ├── Newtonsoft.JSON.12.0.2/
│ ├ ├── Jquery3.1.4/
│ ├── Project one/
│ ├ ── packages.config
│ ├ ── whatever.cs
│ ├ ── folder /
│ ├ ── another folder /
│ ├── Project Two/
│ ├ ── packages.config
│ ├ ── file.cs
│ ├ ── folder/
│ ├ ── another folder/
├── Solution Two/
│ ├ Solution 2.sln
│ ├ nuget.config
│ ├── Packages/
│ ├ ├── Newtonsoft.JSON.11.1.0/
│ ├ ├── Jquery1.3.4/
│ ├── Project one/
│ ├ ── packages.config
│ ├ ── whatever.cs
│ ├ ── folder /
│ ├ ── another folder /
│ ├── Project two/
│ ├ ── packages.config
│ ├ ── file.cs
│ ├ ── folder/
│ ├ ── another folder/
I have tried running this powershell in Package Manager Console but this only applies to one solution at a time:
$packageId = "jquery"
Get-ChildItem *.sln -recurse | %{.\\nuget.exe restore $_.fullname}
Get-ChildItem packages.config -Recurse `
| Where-Object {$_ | Select-String -Pattern $packageId} `
| %{.\\nuget.exe update -Id $packageId $_.FullName}
Do I need to update packages.config in each solution of each project and open them in order to get the updates? I would have thought there would be an easier way to do this. I am using a private nuget server if it makes a difference.
Note: I have looked at this question: Updating nuget packages in all projects in a solution and it is not the same scenario as mine. I'm looking to update packages across multiple solutions, not multiple projects in one solution.
As #imps said in the comments, there's no solution for packages.config projects across solutions. Within a solution you can use the NuGet Package Manager UI's "Manage packages for solution" and the consolidate tab helps makes sure all projects use the same version, but you'll need to repeat this for all solutions.
If you migrate from packages.config to PackageReference, you could take advantage of MSBuild extensibility and either import a common props file, or if using Visual Studio 2017 or newer, use Directory.Build.Props in the highest common parent directory of all the projects.
In your props file, you define the versions of the packages you care about, something like this:
<Project>
<PropertyGroup>
<NewtonsoftJsonVersion>12.0.1</NewtonsoftJsonVersion>
</PropertyGroup>
</Project>
and then in your csproj files, use <PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonVersion)" />. The issue with this is that you can no longer use the Package Manager UI or Package Manager Console in VS to upgrade (well you can, but it'll change it in the csproj, not your props file), but you can still use the UI to check for updates. If you add your props file to your solution, then it just takes two clicks and a few taps on your keyboard to update, so it's really not a big deal.
In your example, the common parent directory would be the TFS root, so $/Directory.Build.props. The problem with this is if you use CI and have a trigger to run the Solution One build on changes to $/Solution One/* and run the Solution Two build on changes to $/Solution Two/*, then they'll both miss changes to $/Directory.Build.props. Or maybe it is possible to configure TFS build triggers to include it, but I don't remember because I haven't used TFVC is such a long time.
However, the bigger issue is that in your example, it's clear you're using the jQuery package. This uses content, which copies files into your project on install/upgrade. PackageReference doesn't work this way (it's listed as a package compatibility issue) , so unless you want to have a different process for upgrading jQuery and any other js/css in your web projects, you can't migrate ASP.NET projects to PackageReference. Note that ASP.NET Core projects are SDK style which only support PackageReference, not packages.config, and typically use either LibMan or npm to get css and javascript.
Customers who can migrate to SDK style projects, they could even consider using this SDK for central package management that helps ensure you don't accidently leave a version number in your csproj.

Generating single ScalaDoc for multiple sub-projects using Gradle

I'm using Gradle (v2.3) for a project, that contains multiple Scala sub-projects. Generating the ScalaDoc for each sub-project individually works as expected (running gradle :project-a:scaladoc or gradle :project-b:scaladoc).
But how do a get a single ScalaDoc of all Scala sub-projects? The minimal project below leads to a "Cannot invoke method withInputStream() on null object" error, when executing
gradle scaladoc --info:
Starting Build
Compiling settings file '/tmp/gradle-scaladoc-test/settings.gradle' using StatementExtractingScriptTransformer.
Compiling settings file '/tmp/gradle-scaladoc-test/settings.gradle' using BuildScriptTransformer.
Settings evaluated using settings file '/tmp/gradle-scaladoc-test/settings.gradle'.
Projects loaded. Root project using build file '/tmp/gradle-scaladoc-test/build.gradle'.
Included projects: [root project 'some project', project ':project-a', project ':project-b']
Evaluating root project 'some project' using build file '/tmp/gradle-scaladoc-test/build.gradle'.
Compiling build file '/tmp/gradle-scaladoc-test/build.gradle' using StatementExtractingScriptTransformer.
Compiling build file '/tmp/gradle-scaladoc-test/build.gradle' using BuildScriptTransformer.
Evaluating project ':project-a' using empty build file.
Evaluating project ':project-b' using empty build file.
All projects evaluated.
Selected primary task 'scaladoc' from project :
Tasks to be executed: [task ':scaladoc', task ':project-a:compileJava', task ':project-a:compileScala', task ':project-a:processResources', task ':project-a:classes', task ':project-a:scaladoc', task ':project-b:compileJava', task ':project-b:compileScala', task ':project-b:processResources', task ':project-b:classes', task ':project-b:scaladoc']
:scaladoc (Thread[main,5,main]) started.
:scaladoc
Executing task ':scaladoc' (up-to-date check took 0.448 secs) due to:
No history is available.
:scaladoc FAILED
:scaladoc (Thread[main,5,main]) completed. Took 0.768 secs.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':scaladoc'.
> Cannot invoke method withInputStream() on null object
* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.
BUILD FAILED
Total time: 5.198 secs
Stopped 0 compiler daemon(s).
Directory structure:
├─ project-a/
│   └─ src/
│   └─ main/
│   └─ scala/
│   └─ package_a/
│   └─ A.scala
├─ project-b/
│   └─ src/
│   └─ main/
│   └─ scala/
│   └─ package_b/
│   └─ B.scala
├─ build.gradle
└─ settings.gradle
build.gradle
subprojects {
repositories {
mavenCentral()
}
apply plugin: 'scala'
dependencies {
compile 'org.scala-lang:scala-library:2.11.6'
}
tasks.withType(ScalaCompile) {
scalaCompileOptions.additionalParameters = ['-unchecked', '-deprecation', '-feature']
scalaCompileOptions.useAnt = false
}
}
task scaladoc(type: org.gradle.api.tasks.scala.ScalaDoc) {
group = 'Documentation'
description = 'Aggregated ScalaDoc documentation.'
title = 'Title of documentation'
destinationDir = new File(buildDir, "aggregated-api")
source subprojects.collect { project ->
project.sourceSets.main.allScala
}
scalaClasspath = files(subprojects.collect { project ->
project.sourceSets.main.compileClasspath
})
classpath = files(subprojects.collect { project ->
project.sourceSets.main.compileClasspath
})
}
settings.gradle
rootProject.name = 'some project'
include 'project-a', 'project-b'
A.scala
package package_a
case class A(value: Int)
B.scala
package package_b
case class B(value: Int)
The only similar problem I could find is "Gradle Fails to Compile Basic Scala Project", but it doesn't help here (and is about Gradle 1.3).
I know it's been a while since this has been asked, but since I just had the exact same problem...
I solved it the following way:
task aggregatedScaladocs(type: ScalaDoc, description: 'Generate scaladocs from all child projects as if it were a single project', group: 'Documentation') {
destinationDir = file("$buildDir/docs/scaladoc")
title = "$project.name $version API"
subprojects.each { proj ->
proj.tasks.withType(ScalaDoc).each {
source += proj.sourceSets.main.allJava
source += proj.sourceSets.main.allScala
classpath += proj.sourceSets.main.compileClasspath
excludes += scaladoc.excludes
includes += scaladoc.includes
}
}
}
Hope it'll help somebody at some point.
For Gradle 6.x I needed to use slightly modified version of answer by #juwi.
task aggregatedScaladocs(type: ScalaDoc, description: 'Generate scaladocs from all child projects as if it were a single project', group: 'Documentation') {
destinationDir = file("$buildDir/docs/scaladoc")
title = "$project.name $version API"
classpath = project.files([])
scalaClasspath = project.files([])
subprojects.each { proj ->
proj.tasks.withType(ScalaDoc).each {
source proj.sourceSets.main.allJava
source proj.sourceSets.main.allScala
classpath += proj.scaladoc.classpath
scalaClasspath += proj.scaladoc.scalaClasspath
exclude proj.scaladoc.excludes
include proj.scaladoc.includes
}
}
}

PowerShell: How to install the DSC Resource Kit Wave 8 modules?

I am trying to set up a DSC pull server on Windows 2012 R2 machine by following this technet article:
http://technet.microsoft.com/en-us/library/dn249913.aspx
However I just can't get the modules working. The installation instructions says:
To install all DSC Resource Kit Modules, unzip the content under
$env:ProgramFiles\WindowsPowerShell\Modules
To confirm installation run Get-DSCResource to see that all of the
resources on this page are among the DSC Resources listed.
So I copied the content of the 'DSC Resource Kit Wave 8 10282014' folder to C:\Program Files\WindowsPowerShell\Modules which now looks as follows:
c:\Program Files\WindowsPowerShell\Modules>tree
├───cFileShare
│ ├───DSCResources
│ │ ├───VSAR_cCreateFileShare
│ │ └───VSAR_cSetSharePermissions
│ ├───Examples
│ ├───ResourceDesignerScripts
│ └───Unit Tests
├───xActiveDirectory
│ ├───DSCResources
│ │ ├───MSFT_xADDomain
│ │ ├───MSFT_xADDomainController
│ │ ├───MSFT_xADDomainTrust
│ │ ├───MSFT_xADUser
│ │ └───MSFT_xWaitForADDomain
│ └───Misc
├───xAdcsDeployment
│ ├───DSCResources
│ │ ├───MSFT_xAdcsCertificationAuthority
│ │ └───MSFT_xAdcsWebEnrollment
│ └───xCertificateServices
│ ├───DSCResources
│ │ ├───MSFT_xAdcsCertificationAuthority
│ │ └───MSFT_xAdcsWebEnrollment
│ └───Examples
[...]
Then I restarted my PowerShell console to ensure it's reloading $env:PSModulePath which contains this by the way (added linewrap manually for better readability):
PS C:\Users\Administrator> $env:PSModulePath
C:\Users\Administrator\Documents\WindowsPowerShell\Modules;
C:\Program Files\WindowsPowerShell\Modules;
C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
So everything is pretty much default here. However get-module -ListAvailable is just not listening any of the above modules e.g. xPSDesiredStateConfiguration. Also the Get-DscResource cmdlet is not returning any ressources that come with this module (especially xDSCWebService is the DSC resource I am looking for to setup the pull server).
If I manually copy the content of xPSDesiredStateConfiguration\DSCResources\* to one of the modules path folder's I do see the DSC resources. However the pull-server setup script (Sample_xDscWebService.ps1) fails. Opening the editor it shows me a syntax error near to:
Import-DSCResource -ModuleName xPSDesiredStateConfiguration
I just can't figure out what I am doing wrong here. So, how can I install the DSC Resource Kit?
I had the same problem. After installation of 3 updates (KB2894029, KB2894179 and KB2883200) everything works ;)
This issue seems to be related to some missing patches. Unfortunately I dont know which one. The link to the blog post below is mentioning KB2883200. But installing it on my system did not make a change.
However it works on another fully patched Windows 2012 R2 server. Unfortunatley I don't have an easy access at work to patch my manually installed server to the latest available.
http://blogs.msdn.com/b/powershell/archive/2013/12/26/holiday-gift-desired-state-configuration-dsc-resource-kit-wave-1.aspx
I had this error and fixed it!
See my blog post at http://tfl09.blogspot.com//2015/04/using-dsc-resource-kit-hot-fixes-may-be.html
That location points to the specific patches you need.