demopack icon indicating copy to clipboard operation
demopack copied to clipboard

Error: Child compilation failed

Open Maamun opened this issue 7 years ago • 14 comments

Hi Jack ! i followed every step on the youtube video and when i type demopack in my terminal i keep getting this error capture d ecran 2017-10-31 a 23 11 23

Maamun avatar Oct 31 '17 23:10 Maamun

Hey! This was an issue in an older version of Demopack. Can you run demopack --version and see what it says?

jackfranklin avatar Nov 01 '17 09:11 jackfranklin

I've tried to use this this morning and have installed from fresh and am getting the same issue. The version I'm running is 0.2.0.

swudged avatar Nov 01 '17 10:11 swudged

A bit more info for you as that was a bit terse 😅

I'm using demopack through npm scripts:

{
  "name": "demopack-test",
  "version": "1.0.0",
  "description": "",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "demopack"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@jackfranklin/demopack": "^0.2.0"
  }
}

Directory structure was completely fresh, did an npm init -y && npm i -D @jackfranklin/demopack and quickly added the npm script.

Node version is 8.7.0 and npm version is 5.4.2.

swudged avatar Nov 01 '17 10:11 swudged

i tried to run demopack both globally and through npm scripts and i got the same issue capture d ecran 2017-11-01 a 11 24 28

Maamun avatar Nov 01 '17 11:11 Maamun

This is frustrating; I spent a while trying to get the webpack resolution working properly and believed that I had done ( as per https://github.com/jackfranklin/demopack/blob/master/lib/webpack-config.js#L64 ).

I'll do some digging but any help is welcome!

jackfranklin avatar Nov 01 '17 16:11 jackfranklin

@mrdbarker demopack is designed to be a global install, just FYI, although it should still work locally. Trying to figure out a more reliable way of getting to demopack's own node_modules directory such that it can find its dependencies.

jackfranklin avatar Nov 01 '17 16:11 jackfranklin

Unfortunately demopack does work perfectly on my machine so it's hard to debug this.

Anyone who has this problem - I'd love you to find the webpack-config file I linked to above in your global install and try changing the resolveModules.modules path. We have to tell webpack that for demopack, it should look in demopack's node_modules folder for all the loaders and plugins, which is not its default behaviour.

That's working on my machine but I've obviously not got the config set up right for everyone.

jackfranklin avatar Nov 01 '17 16:11 jackfranklin

@TheLarkInn I'm wondering if you could spare 2 mins to see if I could do this in a better way...

jackfranklin avatar Nov 01 '17 16:11 jackfranklin

I wonder if we could swap to https://www.npmjs.com/package/findup-sync to find the nearest parent node_modules directory from the webpack-config.js file as that would find the right one in all cases.

jackfranklin avatar Nov 01 '17 16:11 jackfranklin

@jackfranklin i wish i could help but im a beginner and honestly there is a lot of stuff right here that i still can t understand, i couldn't find the webpack-config file, i thought it was on the directory for globally installed node modules which is /usr/local/lib/node_modules but there was no demopack directory

Maamun avatar Nov 01 '17 17:11 Maamun

i'm sure of using the -g flag when isntalling the demopack, but when i type npm list -g --depth=0 there is no such demopack global dependency among the list !! capture d ecran 2017-11-01 a 17 48 07

Maamun avatar Nov 01 '17 17:11 Maamun

@Maamun does which demopack give you the path?

jackfranklin avatar Nov 06 '17 18:11 jackfranklin

@jackfranklin it prints : /usr/local/bin/demopack , i opened the demopack file in atom and i found this const makeWebpackConfig = require('../lib/webpack-config'), but i can't find the file in the lib directory !! capture d ecran 2017-11-07 a 20 07 20

Maamun avatar Nov 07 '17 18:11 Maamun

It wouldn't be there, the demopack will be a symlink I expect to somewhere else. If you do ll /usr/local/bin you should the symlink.

It can definitely find the webpack.config.js file else you'd be getting errors about that :)

jackfranklin avatar Nov 08 '17 09:11 jackfranklin