madeleineostoja / wordprismic

Utility to import existing Wordpress blogs into the Prismic.io content platform
31 stars 11 forks source link

Error - Unexpected end of JSON input #5

Open hades200082 opened 3 years ago

hades200082 commented 3 years ago

Config file

module.exports = {
  wordpress: {
    url: 'https://www.parcelhub.co.uk'
  },
  prismic: {
    repo: 'parcelhubltd',
    locale: 'en-gb',
    categoriesType: ''
  },
  optimizeMediaRequests: false,
  schema: async function(post, html) {
    return {
      type: 'post',
      uid: post.slug,
      title: html.decode(post.title.rendered),
      content: await html.parse(post.content.rendered)
    };
  }
};

Output shown in CLI

> npx wordprismic -c .\wp-prismic-config.js
Downloading content
Fetching users...
Fetching posts...
Fetching page 2 of posts...
Fetching page 3 of posts...
Fetching categories...
Fetching media...
Fetching page 2 of media...
Fetching page 3 of media...
Fetching page 4 of media...
Fetching page 5 of media...
Fetching page 6 of media...
Fetching page 7 of media...
Fetching page 8 of media...
Fetching page 9 of media...
Fetching page 10 of media...
Fetching page 11 of media...
Fetching page 12 of media...
Fetching page 13 of media...
Fetching page 14 of media...
Fetching page 15 of media...
Fetching page 16 of media...
Fetching page 17 of media...
Fetching page 18 of media...
Fetching page 19 of media...
Fetching page 20 of media...
Parsing content
undefined:1

SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at C:\Users\lee20\AppData\Roaming\npm-cache\_npx\35520\node_modules\wordprismic\lib\utils.js:76:22
    at ChildProcess.exithandler (child_process.js:315:5)
    at ChildProcess.emit (events.js:315:20)
    at maybeClose (internal/child_process.js:1048:16)
    at Socket.<anonymous> (internal/child_process.js:439:11)
    at Socket.emit (events.js:315:20)
    at Pipe.<anonymous> (net.js:673:12)
popovdk commented 3 years ago

i same issue

hades200082 commented 3 years ago

With no commits to the repo in 2 years and no action on this from any maintainer I'm guessing this project is dead. Shame as Prismic are still linking to it from their docs

skilar commented 3 years ago

I know it's been a few months, but this error should be fixed now, @hades200082 and @popovdk. There were a couple bugs in one of wordprismic's dependencies that have been fixed.

sendmenas commented 2 years ago

I still get the json error, I use latest version

sendmenas commented 2 years ago

I kind of solved this problem by installing required ruby gems locally to my computer, then it started to work. So I guess you need not only Ruby in your machine, but 'kramdown-prismic' and 'json' gems as well

madeleineostoja commented 2 years ago

Heya sorry for the radio silence on this one. I haven't needed to port a wordpress site to prismic for a long time so I haven't had time to look into this. Very happy to accept PRs for a fix if anyone has one

DouglasValerio commented 2 years ago

I've had the same issue when trying to import content, but as @sendmenas pointed out, installing the gems locally solved the problem. Run in your terminal: gem install json gem install kramdown-prismic

It should solve the issue.

ammakr commented 4 months ago

I did this gem install json and gem install kramdown-prismic. and regardless the error is not resolved. If someone has a solution please suggest.