Internal Server Error after installing external packages

I’ve encountered a similar error after installing both the head-tags and frontity-contact-form-7 packages. I first encountered the error in a theme I was working on for one of my wife’s sites and followed the steps at https://docs.frontity.org/guides/keep-frontity-updated#troubleshooting with no joy.

I’ve also created a new project with the Mars theme and have encountered similar issues after doing nothing more than installing the same two packages.

I’m in the project root when installing each and the install appears to be successful.

The frontity.settings.js file is as follows.

const settings = {
“name”: “makebreaks”,
“state”: {
“frontity”: {
“url”: “http://localhost:3000/”,
“title”: “Make Breaks”,
“description”: “Discover new things to do”
}
},
“packages”: [
{
“name”: “makebreaks-theme”
},
{
“name”: “@frontity/wp-source”,
“state”: {
“source”: {
“api”: “https://makebreaks.com/wp-json”
}
}
},
“@frontity/tiny-router”,
“@frontity/html2react”,
// “@frontity/head-tags”,
// “frontity-contact-form-7”
]
};

If I uncomment either of the packages and reload the site, the front end displays Internal Server Error.

CLI displays this when head-tags enabled.

TypeError: Cannot convert undefined or null to object
at Function.keys ()
at getKeys (webpack-internal:///./node_modules/deepmerge/dist/umd.js:2:1009)
at mergeObject (webpack-internal:///./node_modules/deepmerge/dist/umd.js:2:1282)
at deepmerge (webpack-internal:///./node_modules/deepmerge/dist/umd.js:2:2056)
at state.frontity.packages.forEach.name (webpack-internal:///./node_modules/@frontity/core/src/utils/merge-packages.ts:8:484)
at Array.forEach ()
at webpack_exports.default (webpack-internal:///./node_modules/@frontity/core/src/utils/merge-packages.ts:8:226)
at webpack_exports.default (webpack-internal:///./node_modules/@frontity/core/src/server/store.ts:5:271)
at app.use (webpack-internal:///./node_modules/@frontity/core/src/server/index.tsx:47:68)
at process._tickCallback (internal/process/next_tick.js:68:7)

The following displays if frontity-contact-form-7 enabled.

TypeError: Cannot convert undefined or null to object
      at Function.keys (<anonymous>)
      at getKeys (webpack-internal:///./node_modules/deepmerge/dist/umd.js:2:1009)
      at mergeObject (webpack-internal:///./node_modules/deepmerge/dist/umd.js:2:1282)
      at deepmerge (webpack-internal:///./node_modules/deepmerge/dist/umd.js:2:2056)
      at eval (webpack-internal:///./node_modules/@frontity/core/src/utils/merge-packages.ts:8:484)
      at Array.forEach (<anonymous>)
      at __webpack_exports__.default (webpack-internal:///./node_modules/@frontity/core/src/utils/merge-packages.ts:8:226)
      at __webpack_exports__.default (webpack-internal:///./node_modules/@frontity/core/src/server/store.ts:5:271)
      at eval (webpack-internal:///./node_modules/@frontity/core/src/server/index.tsx:47:68)
      at runMicrotasks (<anonymous>)

I’m on Windows 10 (perhaps this makes me a freak). Node version is 12.18.3.

Am I doing something silly? I’ve reread the external packages process several times, but I’m perfectly capable of doing something daft.

Otherwise, any thoughts on what’s at play here and any possible solutions?

Thanks

Hi @ianpullen

Welcome to the community. Sorry that you’re having problems. When you followed the troubleshooting steps did you remove the node_modules folder and package-lock.json file from the local packages as well as the root of your project?

Failing that, do you have a repo of your project that we can clone?

Hi @mburridge, thanks for your response.

There wasn’t a package-lock.json file present in the local packages, only at the root level.

I haven’t got a repo of this, but the same problem occurred with a new project with the Mars theme and just the two packages installed. Again, no package-lock.json file present with the Mars theme package.

Hmm, interesting. Okay, I’ll try to reproduce your problem by creating a new project and then adding the packages you mention. I’ll let you know how I get on.

Meanwhile could you run npx frontity info in the root of your project and post the output here. Thanks.

This is the result of npx frontity info from the new project with Mars theme.

System:

  • OS: Windows 10 10.0.18362
  • CPU: (4) x64 Intel® Core™ i5-7200U CPU @ 2.50GHz
  • Memory: 3.09 GB / 11.44 GB

Binaries:

  • Node: 12.18.3 - C:\Program Files\nodejs\node.EXE
  • npm: 6.14.6 - C:\Program Files\nodejs\npm.CMD

Browsers:

  • Chrome: 84.0.4147.105
  • Edge: Spartan (44.18362.449.0)
  • Internet Explorer: 11.0.18362.1

npmPackages:

  • @frontity/core: ^1.7.3 => 1.7.3
  • @frontity/head-tags: ^1.0.4 => 1.0.4
  • @frontity/html2react: ^1.3.4 => 1.3.4
  • @frontity/mars-theme: ./packages/mars-theme => 1.4.3
  • @frontity/tiny-router: ^1.2.1 => 1.2.1
  • @frontity/wp-source: ^1.8.1 => 1.8.1
  • frontity: ^1.10.1 => 1.10.1
  • frontity-contact-form-7: ^0.1.7 => 0.1.7

npmGlobalPackages:

  • frontity: Not Found
  • npx: Not Found

If it helps, I can put that new project onto Github, but I’m not sure that’s going to give you anymore info.

Hi @mburridge

I just tried creating a new project on macOS and got the same error, which seemed to prove I was doing something daft.

It turns out the cause was me adding the packages to frontity.settings.js while the server was running. I guess that just gets loaded when the server starts.

Probably obvious to most, but may be useful to bear in mind in case anyone else posts a similar issue.

Thanks for your help the other day.

Hi @ianpullen

Sorry I didn’t get round yet to cloning your repo, but I’m glad you figured it out in the end.

We’d love to know what you’re planning to build with Frontity. We feature interesting projects built with Frontity on our showcases page.

I’m not sure it’ll be sexy enough for your showcase @mburridge - it’s one of the wife’s sites that offers free downloads for crafters.

The current site performs dreadfully in speed tests, but it’s good ad revenue for little work. Trying to optimise it has been on my to do list for an age in the hope it’ll get the site a bit more Google love.

I’ll make a mental note to post it when it’s done, though I fear our paths may yet cross when I try to put it live. Fingers crossed that will go smoothly :crossed_fingers:

Do please submit it here when it’s done. We’d love to see it and consider it for inclusion in our showcases page (incidentally it’s not me that makes that decision :laughing:).

1 Like