Gridsome: `gridsome build` hangs after Compile assets

Created on 15 Apr 2019  路  26Comments  路  Source: gridsome/gridsome

Description

Upon creating a new, OOTB project and running gridsome build, it hangs after Compile assets and never creates any HTML files.

Steps to reproduce

  1. Install the gridsome cli: sudo npm install --global @gridsome/cli
  2. Create the project: gridsome create ttoo
  3. cd ttoo
  4. Build with gridsome build

Expected result

A /dist folder with HTML, JS and CSS etc.

Actual result

gridsome build
Gridsome v0.5.7

Initialize - 0.45s
Load sources - 0.03s
Create GraphQL schema - 0.03s
Set up routes - 0s
Generate code - 0.02s
Bootstrap finish - 0.54s
Run GraphQL (0 queries) - 0s
Compile assets - 3.15s

A /dist folder with:

/assets/css/*styles..css
/assets/js/app|component|page*.js
/assets/manifest/client|server.json

Environment


Libs:
- gridsome version: 0.5.7
- @gridsome/cli version: 0.0.9

For Tooling issues:
- Node version: 10.15.3
- Platform:  Mac 10.14.4

Others:
- Yarn version: 1.15.2

Most helpful comment

I also experienced this and tried to do some debugging. It works when downgrading vue-router. Can anyone else confirm this? Try adding this to package.json and reinstall dependencies with Yarn:

"resolutions": {
  "gridsome/vue-router": "3.0.2"
}

All 26 comments

@stowball

I'm getting this same issue. It says it compiles assets within 13.65s, and then has been hanging for the last 20 minutes.

Would also love a fix for this. Just upgraded to latest version of Gridsome, deleted my .cache folder as I was having problems, and problem still persists.

So at this point, I can't make any updates at all to my site until this issue is fixed.

Same here. The problem appeared after running npm install --save command which upgraded Gridsome. But I downgraded to 0.5.4 and the issue is still there.

@jd-fillmore @stowball did you manage to downgrade and make building work? I didn't. Even deleting all node_modules, reinstalling them with NPM/Yarn, deleting .cache didn't help.

I also experienced this and tried to do some debugging. It works when downgrading vue-router. Can anyone else confirm this? Try adding this to package.json and reinstall dependencies with Yarn:

"resolutions": {
  "gridsome/vue-router": "3.0.2"
}

@hjvedvik this helped, thanks!

Thanks for the help @hjvedvik - I'm running into this issue too. Unfortunately downgrading vue-router to 3.0.2 and clearing cache hasn't helped me? Is there something I'm possibly missing?

My setup is:

Gridsome:

  • @gridsome/cli v0.0.9
  • gridsome v0.5.7

Tooling:

  • Node version: 11.14.0
  • Platform: Mac 10.14.4
  • Yarn version: 1.15.2

@timcreatewell could you share your code please?

"resolutions": {
"gridsome/vue-router": "3.0.2"
}

This did not solve it for me. Mine problem project is just a clone of https://github.com/gridsome/gridsome-starter-markdown-blog.git

Hi @sergeyfilimonov , thanks for reaching out! Unfortunately the code is in a private repo so I'm unable to share it :(

I've done some debugging though and can confirm that a brand new project (with the vue-router change applied) does build on my system.

Additionally, I think I have narrowed down the cause of the build error in my current project. I have added Vuex and some route guards in gridsome.client.js. Where I believe things are failing are when I use route guards that reference getters in my Vuex store, for example:

import store from './src/store/index'

export default function (Vue, options, context) {
  context.appOptions.store = store

  context.router.beforeEach((to, from, next) => {
    // store getters simply return a boolean value
    if (to.name === "finalise" && 
            (!store.getters['contact/hasContact'] || 
             !store.getters['product/hasProduct'])) {
      next({ name: 'foo' });
      return
    }

    ...

    next();
  });
}

The example getters contact/hasContact and product/hasProduct listed above simply return a boolean value.

If I comment route guards like the example listed above out, the build passes.

Interestingly, the route guards all work when I run gridsome develop.

Am I perhaps mis-configuring this, that is, I shouldn't be referring to the store in this manner?

Thanks!

I have the same problem.

On clean system I installed brand new gridsome project, and without adding any code, gridsome build hangs after Compile assets.

Issue persists on both MacOS (Mojave 10.14.4) and Windows 10.

Got the same issue. However, downgrading vue-router seems to fix it for me.

I'm using NPM so I'm unable to use the resolutions fix. This issue is blocking me from launching my website unless I completely refactor the way I use SVGs on the website (which would take a lot of my time). Truly infuriating.

I'm considering not using Gridsome at all as it seems to be too unstable.

@vandelay87 your SVGs are somehow dependent on using NPM instead of Yarn?

Using the npm package 'npm-force-resolutions' to downgrade vue router without yarn, I can confirm that my site now builds. I put the following in my resolutions:

"@gridsome/vue-router": "3.0.2", "vue-router": "3.0.2"

"resolutions": {
  "gridsome/vue-router": "3.0.2"
}

This seems to fix the issue for me (a hang on build). To anyone else who, like me, was new to resolutions in their package.json, here's an overview.

@sergeyfilimonov Thanks for the condescending reply. I understand that SVGs are not dependant on NPM. I sometimes develop on Windows (yeah, I know) and I have had problems with Yarn in the past, so I'm somewhat timid to switch.

@stuible Thanks, I will try that tomorrow.

@hjvedvik @sergeyfilimonov @timcreatewell @apertureless @allanwhite

Pasted the below code into package.json:

"resolutions": {
  "gridsome/vue-router": "3.0.2"
}

Here's a codesandbox of my site.

Tried uninstalling node modules, used ''npm-force-resolutions' package to downgrade as well, reinstalled node_modules, tried gridsome build and still hangs.

Any other suggestions guys? Driving me nuts.

Same problem over here. Everything was just fine a week ago, also using 0.5.7. Tried all the recommended things here and none work 馃 . Wondering what the problem could be.

I've done some further debugging... By the looks of things things aren't building for me when I try to route to a different path in a route guard within gridsome.client.js.

e.g.

...
context.router.beforeEach((to, from, next) => {
    if (to.name === "foo") {
        next({ path: '/bar' });
        return;
    }
    ...

My hunch is that the build process knows nothing of the /bar page at the time that it's processing the gridsome.client.js file and therefore hangs?

Is anyone else using route guards like this?

@vandelay87 Your SVGs should be fine. This bug is caused by a change in the latest version of vue-router. I'll publish a fix later today :)

Looks like the vue-router team has been busy. This issue was fixed in 3.0.4 but reintroduced in 3.0.5 and then fixed again in 3.0.6. So just make sure your lock files use the latest vue-router.

Looks like the vue-router team has been busy. This issue was fixed in 3.0.4 but reintroduced in 3.0.5 and then fixed again in 3.0.6. So just make sure your lock files use the latest vue-router.

Updated vue-router to 3.0.6 and I can confirm this is working. My project is building now. Thank you very much! 馃槃

I can confirm after adding the vue-router resolution my project now builds. Thanks for the useful thread and responses.

Hi guys,

I've updated my vue-router to 3.0.6 (via npm-force-resolutions) and in my case it's still hanging. I've checked what version of the vue-router is being used by /node_modules/gridsome/node_modules/vue-router/package.json is "_from": "[email protected]", "_id": "[email protected]". So I assume gridsome is using the 3.0.6 version.

....however after all day testing I've figured out my issue had nothing to do with vue-router. My was a simple bug on module registration on Vuex. Didn't get any errors tho.

I'm having the same issue as described, and I am on 3.0.6 vue-router version.

When I comment out the context.router.beforeEach block the build doesn't hang

Yeah, I'm getting this and it doesn't seem to have anything to do with the router.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

itech001 picture itech001  路  32Comments

simonswiss picture simonswiss  路  22Comments

SteveEdson picture SteveEdson  路  44Comments

physcocode picture physcocode  路  26Comments

jakedohm picture jakedohm  路  18Comments