avatar
Grunt build/dev error
by Sam Howell - Monday, 20 April 2020, 2:51 PM
 

I'm trying to run 'grunt dev' in order to develop a theme for my course.

I've done the following so far:

  1. Create/copy a course in the Adapt authoring tool via browser.
  2. Export that course's source.
  3. Transfer this .zip file to a new directory on my server.
  4. Extract the .zip in this folder.
  5. Run 'npm install' in order to get node modules.
  6. Run 'grunt dev'

At this point I receive the following error:

Running "_log-vars" task
>> Using source at 'src/'
>> Building to 'build/'

Running "check-json" task
>> Orphaned _ids: undefined
Warning: Oops, looks like you have some json errors. Use --force to continue.

Aborted due to warnings.

I'd greatly appreciate it if someone could point out where I've gone wrong.

Thanks

 


Picture of Matt Leathes
Re: Grunt build/dev error
by Matt Leathes - Tuesday, 21 April 2020, 10:41 AM
 

Well the obvious thing is that you are trying to do this within your authoring tool's temp/THEME folder which seems odd and perhaps quite risky. Whether it's causing the problem you're seeing or not is another matter but personally I would start by undoing what you've done, exporting the source again but this time unzipping it to a directory outside of your adapt_authoring folder.

avatar
Re: Grunt build/dev error
by Sam Howell - Tuesday, 21 April 2020, 4:24 PM
 

Thanks for pointing that out. I've only just started developing in the back end so I'm still getting used to the overall structure.

However, after trying to build my exported source from another (safer) directory outside of adapt_authoring, I got the same error: Orphaned _ids: undefined (though I don't know how to fix this).

I thought it may be related to the 'includes' array in the config.json file after exporting. I read that this should be removed before running 'grunt build', but I couldn't find any mention of 'includes' in config.json.

Picture of Matt Leathes
Re: Grunt build/dev error
by Matt Leathes - Tuesday, 21 April 2020, 5:20 PM
 
I thought it may be related to the 'includes' array in the config.json file after exporting. I read that this should be removed before running 'grunt build', but I couldn't find any mention of 'includes' in config.json

The includes array tells the build process what, out of all the installed plugins, should actually be build into the output. (I think it also defines which ones get exported when you do a source export).

When working in the framework you typically don't bother with this as normally you just install the plugins you need and have them all built into the output.

If it's there, it'll be inside a property called build. If it's not, don't worry.

As for your error, that's a bit of an odd one. In Adapt, every single content object ('page' in AAT terminology), article, block and component needs to have an _id property and they all need to be unique*.

Furthermore, each component, block, article and content object needs to have a _parentId property that contains the _id of the item's 'parent' - and if it doesn't have a valid 'parent' it's flagged as being 'orphaned'.

However, since the authoring tool generates these for you automatically it's a bit odd that you should be a) getting this error and that b) it's unable to identify where it's happening (hence the 'undefined').

If I'm honest, I don't really know what to suggest here... this is always something that has 'just worked' for me!

Hopefully someone else might be able to shed some light on this?

It might be useful to know what version of the authoring tool/framework you have. I explain how to check for this here.

* The course itself also needs an _id, though typically this is just set to "course".

Picture of Ignacio Cinalli
Re: Grunt build/dev error
by Ignacio Cinalli - Tuesday, 21 April 2020, 8:09 PM
 

Hi, I'm dealing with that too.

The authoring tool adds the file course/en/assets.json.

If you delete that file the grunt process runs without errors.

I don't know if that file should be filtered here ?

 

 

avatar
Re: Grunt build/dev error
by Sam Howell - Wednesday, 22 April 2020, 6:34 AM
 

Hi Ignacio. I tried your method, deleting the assets.json file, which resulted in no errors during the build, but then my course still wouldn't load and remained stuck with the three loading dots.

Picture of Matt Leathes
Re: Grunt build/dev error
by Matt Leathes - Wednesday, 22 April 2020, 2:19 PM
 

any errors in the browser console?

avatar
Re: Grunt build/dev error
by Sam Howell - Wednesday, 22 April 2020, 6:51 AM
 

Hi Matt, thanks for this detailed explanation.

I recently began developing my first theme by using the framework with 'grunt dev', manually inserting content objects (is it correct to also refer to articles etc. as content objects, or is this only 'pages'?), tweaking my theme etc. The silver lining to having trouble with building from my AT export is that I've learnt more about how a course is actually built - rather a blessing in disguise as I'm trying to learn what I can about the underlying code (my current understanding is mostly limited to CSS and LESS).

The only other thing I can imagine might work for my previous json error is to go into each course file and manually check/change the IDs.

However, since trying Ignacio's method, seeing no more errors, but still not being able to load my course, I don't know what to think!

Here are my current versions...

Adapt authoring tool - 0.10.3
Adapt framework - 5.3.0

Picture of Ignacio Cinalli
Re: Grunt build/dev error
by Ignacio Cinalli - Wednesday, 22 April 2020, 12:21 PM
 

Hi Sam, to clarify, I removing assets.json only to work with the framework on my local machine.

You should not remove it from authoring tool's temp/THEME folder.

avatar
Re: Grunt build/dev error
by Sam Howell - Wednesday, 22 April 2020, 1:33 PM
 

No worries. I only removed the file and tested from a test course.

Overall, I've found it much more reliable to create a course from scratch with the framework, with short, logical object IDs, and developing a theme from there. I now I have a theme I'm happy with and will just take it back into this dev environment when needed.

Picture of Matt Leathes
Re: Grunt build/dev error
by Matt Leathes - Wednesday, 22 April 2020, 2:24 PM
 
Overall, I've found it much more reliable to create a course from scratch with the framework, with short, logical object IDs, and developing a theme from there

This is how we've started doing a lot of our work here at Kineo... pretty much build the entire thing in the Framework then just import into the authoring tool when done.

Only thing you need to be careful of is making sure you check that any customisations you've made actually work in the authoring tool as well - particularly anything that needs the course author to configure something via the AAT interface.

avatar
Re: Grunt build/dev error
by Sam Howell - Wednesday, 22 April 2020, 8:09 PM
 

I think I'll stick to building courses in the AT going forward and using the framework for theme dev when needed. Thanks to everyone in this thread for their input.

Picture of Matt Leathes
Re: Grunt build/dev error
by Matt Leathes - Wednesday, 29 April 2020, 2:58 PM
 

Just to say that this issue with the grunt process trying to read assets.json should be fixed in FW v5.4.0 - just need some help from people to test/review it - is a big pull request!!

avatar
Re: Grunt build/dev error
by Sam Howell - Wednesday, 29 April 2020, 3:43 PM
 

Hi Matt,

I'd be happy to help test if you can tell me the best method. (Would it just involve exporting a course from AT and attempting to grunt build in the framework?)

Also, I received your message recently but couldn't for the life of me see any way to reply! Couldn't find any reply button anywhere. This site can be a little confusing at times.

Do you use Matrix or IRC?

I've just tried to find your message again but can't find where messages are stored.

Picture of Matt Leathes
Re: Grunt build/dev error
by Matt Leathes - Wednesday, 29 April 2020, 4:41 PM
 

Yes, you'll need to export a course from the AAT but then swap the grunt and src/core folders out for the ones from this branch: https://github.com/adaptlearning/adapt_framework/tree/issue/2709-1

Then run npm install then try things like grunt dev, grunt build etc.

If you click on my name in this post then 'send a message' it should take you back to the messages section! Equally, feel free to pop into the Gitter chat. You should find me here.

 

avatar
Re: Grunt build/dev error
by Sam Howell - Thursday, 30 April 2020, 8:04 AM
 

OK thanks, I'll give that a try.