Skip to content
This repository has been archived by the owner on Jul 12, 2023. It is now read-only.

Problem: compose build fails with webpack not found #49

Closed
sevein opened this issue Mar 16, 2018 · 11 comments
Closed

Problem: compose build fails with webpack not found #49

sevein opened this issue Mar 16, 2018 · 11 comments
Labels

Comments

@sevein
Copy link
Member

sevein commented Mar 16, 2018

@cdekok and @ablwr reported the same issue.

This is the Dashboard container:

sh: 1: webpack: not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! transfer-browse@0.0.0 prepublish: `webpack --progress --colors --entry ./app.js`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the transfer-browse@0.0.0 prepublish script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2018-03-16T10_03_57_466Z-debug.log```
@sevein sevein added the dev label Mar 16, 2018
@ablwr
Copy link
Contributor

ablwr commented Mar 16, 2018

For the wider world, I'll note that I'm on macOS Sierra, docker-compose v1.18, docker v17.12.

@sevein
Copy link
Member Author

sevein commented Mar 21, 2018

And FWIW, it's working for me!

image

Radda found this issue too in a different environment so this is likely not because of Compose. See artefactual/deploy-pub#56. @jraddaoui is looking into it.

@cdekok
Copy link

cdekok commented Mar 23, 2018

This looks to be related to an issue with npm it did not add an executable onder ./nodule_modules/bin
if i go into the container and add yarn it does work correctly and the executable is added.
Perhaps consider switching to yarn instead of npm as it is a bit more stable and has some other benefits.

@sevein
Copy link
Member Author

sevein commented Mar 23, 2018

Thanks for checking it out! Agree, we should consider yarn because it definitely seems less problematic. Also, we should merge transfer-browser and appraisal-tab into a single app - they're now separate because they came from different repos. Also it wouldn't hurt to update our frontend libraries in particular webpack, we're using an ancient version!

@nkrabben
Copy link

Is switching to yarn something I could do locally by editing the Makefile or similiar? I'm running into the same webpack error on macOS 10.13.

@sevein
Copy link
Member Author

sevein commented Mar 28, 2018

Totally @nkrabben! During the image build, things happen here:

https://github.com/artefactual/archivematica/blob/qa/1.x/src/dashboard.Dockerfile#L43-L49

COPY dashboard/frontend/transfer-browser/ /src/dashboard/frontend/transfer-browser/
RUN chown -R archivematica:archivematica /src/dashboard/frontend/transfer-browser \
	&& su -l archivematica -c "cd /src/dashboard/frontend/transfer-browser && npm install"

COPY dashboard/frontend/appraisal-tab/ /src/dashboard/frontend/appraisal-tab/
RUN chown -R archivematica:archivematica /src/dashboard/frontend/appraisal-tab \
	&& su -l archivematica -c "cd /src/dashboard/frontend/appraisal-tab && npm install"

The Makefile in this repo also build the frontend assets for us to make it available in the working trees on your host that we're injecting as volumes into the containers. It happens here:

am/compose/Makefile

Lines 78 to 90 in 4c09a46

bootstrap-dashboard-frontend: ## Build front-end assets.
docker-compose run --rm --no-deps \
--user root \
--entrypoint npm \
--workdir /src/dashboard/frontend/transfer-browser \
archivematica-dashboard \
install --unsafe-perm
docker-compose run --rm --no-deps \
--user root \
--entrypoint npm \
--workdir /src/dashboard/frontend/appraisal-tab \
archivematica-dashboard \
install --unsafe-perm

You may notice that we have two frontend apps, appraisal-tab and transfer-browser. It's totally unnecessary, it's like that because they used to live in different repos. I'm hoping in AM18 we can merge them and take that opportunity to update webpack.

@ross-spencer
Copy link
Contributor

Hi folks FYI @tdilauro has is finding the same issue on his mac install as well. Same error as @ablwr above.

@helrond
Copy link

helrond commented Aug 29, 2018

I'm also experiencing this error during the build process when running docker-compose up -d --build.

In addition to the error messages noted by @ablwr above, I also saw the following:

npm WARN prepublish-on-install As of npm@5, `prepublish` scripts are deprecated.
npm WARN prepublish-on-install Use `prepare` for build steps and `prepublishOnly` for upload-only.
npm WARN prepublish-on-install See the deprecation note in `npm help scripts` for more information.

Changing the prepublish key on line 29 of am/src/archivematica/src/dashboard/frontend/transfer-browser/package.json to prepublishOnly resolved the issue during build. HOWEVER that results in further errors down the line so is not recommended...

I'm on macOS High Sierra, Docker version 18.06.0-ce, docker-compose version 1.22.0

@ablwr
Copy link
Contributor

ablwr commented Aug 29, 2018

To get around this, @sevein recommended I build the individual bootstrap frontend requirements locally, and I updated the compose docs to reflect that! Still just a patch, but I was able to make progress. I also then switched to a Linux machine but I look forward to debugging this issue in the future. ;)

https://github.com/artefactual-labs/am/tree/master/compose#make-bootstrap-fails-to-run

@jrwdunham
Copy link
Contributor

I was able to make this work with the naive changes in this WIP PR: #70 (macOS Sierra v10.13.5, docker-compose v1.21, docker v18.03.

@sevein
Copy link
Member Author

sevein commented Sep 29, 2018

Replaced by archivematica/Issues#226.

@sevein sevein closed this as completed Sep 29, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

7 participants