openfisca / legislation-explorer

Explore legislation formulas and parameters.
https://legislation.demo.openfisca.org
GNU Affero General Public License v3.0
26 stars 13 forks source link

Error: Cannot find module '../../webpack-assets.json' #195

Closed Br3nda closed 5 years ago

Br3nda commented 5 years ago

I think i've followed the instructions in README.me, but i can't get past this error message

image

Is there something more i need? I see files webpack.config.prod.babel.js and webpack.config.dev.js Should i do something with them?

I'm using

node --version
v9.11.2

Here's what's in my .env

HOST=0.0.0.0
PORT=2030
PATHNAME=/

API_URL=https://openfisca-aotearoa.herokuapp.com
CHANGELOG_URL=https://github.com/openfisca/country-template/blob/master/CHANGELOG.md

UI_STRINGS={"en":{"countryName":"the development environment"},"fr":{"countryName":"l’environnement de développement"}}
Morendil commented 5 years ago

Hi @Br3nda - I've tried repro'ing this but am not seeing the same outcomes as you.

I use Docker to start from a clean slate, so my process went like this:

docker run --rm -it -v $(pwd):/app:cached -w /app  -p 2030:2030 node:9.11.2 bash

…then in the container:

npm install --production
npm run build
npm start

I used your .env exactly as shown above.

Browsing to localhost:2030 brings up the legislation explorer more or less as expected (some CSS issues, but not the error you're seeing).

If you're also a Docker user this can be a good thing to try. I think it might help to first delete the node_modules directory, it is my understanding that this can be a source of stuff lying around that may result in dependencies not being resolved the same way from one build to the next. Try a git status to see if you have any files changed locally, too.

Otherwise you can reach me on Slack to try and investigate further. One idea would be to compare our versions of package-lock.json files, to see if all dependencies are resolved in the same way.

bonjourmauko commented 5 years ago

Hi @Br3nda !

I've tried this, following instructions:

# read -d ''.env <<- EOF
  HOST=0.0.0.0
  PORT=2030
  PATHNAME=/

  API_URL=https://openfisca-aotearoa.herokuapp.com
  CHANGELOG_URL=https://github.com/openfisca/country-template/blob/master/CHANGELOG.md

  UI_STRINGS={"en":{"countryName":"the development environment"},"fr":{"countryName":"l’environnement de développement"}}
EOF

# echo "$env" > .env
# nvm use 9
Now using node v9.11.1 (npm v5.6.0)

First try

# rm -rf node_modules webpack-assets.json
# npm install --production
# npm run build
# npm start
capture d ecran 2018-09-18 a 14 22 11

Second try

# rm -rf node_modules webpack-assets.json
# npm install
# npm run dev
capture d ecran 2018-09-18 a 14 27 52

So I can't reproduce the exact error either, but there's definitely a missing step to get the assets to work by using the first method described here.

That being said, the instructions could be improved a bit indeed, to allow for easier to follow steps-by-steps.

Br3nda commented 5 years ago

Ive found its the npm build that isn't happening in our Server (or rather, it isn't preserved) . I'll need to move it into a pre deploy step, probably running on Ci and preserving the artefacts. I couldn't find a way to preserve build artefacts on circleci

On Wed, 19 Sep 2018, 00:32 Mauko Quiroga, notifications@github.com wrote:

Hi @Br3nda https://github.com/Br3nda !

I've tried this, following instructions:

read -d '' env <<- EOF

HOST=0.0.0.0 PORT=2030 PATHNAME=/

API_URL=https://openfisca-aotearoa.herokuapp.com CHANGELOG_URL=https://github.com/openfisca/country-template/blob/master/CHANGELOG.md

UI_STRINGS={"en":{"countryName":"the development environment"},"fr":{"countryName":"l’environnement de développement"}} EOF

echo "$env" > .env

nvm use 6

First try

rm -rf node_modules webpack-assets.json

npm install --production

npm run build

npm start

[image: capture d ecran 2018-09-18 a 14 22 11] https://user-images.githubusercontent.com/329236/45687508-489f2580-bb4f-11e8-92be-7c93bdb70696.png Second try

rm -rf node_modules webpack-assets.json

npm install

npm run dev

[image: capture d ecran 2018-09-18 a 14 27 52] https://user-images.githubusercontent.com/329236/45687521-50f76080-bb4f-11e8-8a8d-fb140de3aed7.png

So I can't reproduce the exact error either, but there's definitely a missing step to get the assets to work by using the first method described here.

That being said, the instructions could be improved a bit indeed, to allow for easier to follow steps-by-steps.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/openfisca/legislation-explorer/issues/195#issuecomment-422373039, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAv6pHC3CPFhIPclc1gOLRDpzL3yL8xks5ucOfEgaJpZM4Woll2 .

Morendil commented 5 years ago

@Br3nda thanks, good to know more about this - how can we help ? OK to update the title of the issue to reflect new understanding of what the goal is, e.g. "npm build step not running on CircleCI" ?

Br3nda commented 5 years ago

Closing, found the issue. when I work it out I'll send a PR