brillout / goldpage

Page Builder.
Creative Commons Zero v1.0 Universal
57 stars 3 forks source link

[bug] Cannot find module #4

Closed chriscalo closed 4 years ago

chriscalo commented 4 years ago

In this goldpage starter repo I created, if I run yarn run dev (which in turn runs goldpage dev ./server.js), everything works fine.

There's another branch in which the only change I've made is to install the postinstall-postinstall module. In that branch, if I run the same yarn run dev command, I get the following error:

chriscalo-macbookpro:goldpage-vue-express-starter chriscalo$ yarn run dev
yarn run v1.17.3
$ goldpage dev ./server.js
Error: Cannot find module 'postinstall-postinstall'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.resolve (internal/modules/cjs/helpers.js:33:19)
    at Object.keys.forEach.depName (/Users/chriscalo/Projects/goldpage-vue-express-starter/node_modules/@brillout/autoload/index.js:41:8)
    at Array.forEach (<anonymous>)
    at loadDependencies (/Users/chriscalo/Projects/goldpage-vue-express-starter/node_modules/@brillout/autoload/index.js:37:4)
    at create_ssr (/Users/chriscalo/Projects/goldpage-vue-express-starter/node_modules/goldpage/ssr.js:21:52)
    at Object.<anonymous> (/Users/chriscalo/Projects/goldpage-vue-express-starter/node_modules/goldpage/ssr.js:10:18)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)

    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/Users/chriscalo/Projects/goldpage-vue-express-starter/node_modules/goldpage/bin.js:6:13)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

The module is installed, and this approach works in another project (without goldpage), so it looks like the issue might be in goldpage.

Any idea what might be going on here?

If you're curious, I use postinstall-postinstall along with link-module-alias to alias ~ to the project root so I can do imports like this: (gist)

import { foo } from "~/foo";
brillout commented 4 years ago

I'll have a look tomorrow

chriscalo commented 4 years ago

Don’t rush, this isn’t blocking anything for me, I’m still just investigating using goldpage.

brillout commented 4 years ago

Ok.

I'll take a look tomorrow/Monday.

brillout commented 4 years ago

I've written a fix that I will publish later today/tomorrow.

(The issue was that postinstall-postinstall doesn't have a main script which troubled the Goldpage plugin auto loader.)

chriscalo commented 4 years ago

Right on 👍

brillout commented 4 years ago

Tmrw & I'll answer your other issues as well.

brillout commented 4 years ago

Published at 0.5.3 & see https://github.com/chriscalo/goldpage-vue-express-starter/pull/1.

chriscalo commented 4 years ago

Thanks for the fix, @brillout. I especially didn’t expect the PR on my repo, so an extra thank you for that 🙏

I played around with the setup and it feels like a really great development experience. I’m pretty excited to see if I can fully convert my app to using goldpage.

Thanks again!