Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sh: 1: cross-env: not found #4

Open
mr-feek opened this issue Jul 5, 2020 · 2 comments
Open

sh: 1: cross-env: not found #4

mr-feek opened this issue Jul 5, 2020 · 2 comments

Comments

@mr-feek
Copy link
Contributor

mr-feek commented Jul 5, 2020

Steps to reproduce

  • Fresh laravel project (do not npm install).
  • ./laradose.sh --install
  • docker-compose up

Expected

  • container starts up

Actual

npm run development -- --watch
 cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js "--watch"
npm_1       |
npm_1       | sh: 1: cross-env: not found
npm_1       | npm ERR! code ELIFECYCLE
npm_1       | npm ERR! syscall spawn
npm_1       | npm ERR! file sh
npm_1       | npm ERR! errno ENOENT

Notes

  • I believe we need to npm install before trying to run watch
@AdrienPoupa
Copy link
Owner

You're right, you're seeing this because the JS packages are not installed yet (node_modules is probably missing).

I'm a bit conflicted on this one. On one hand I'd say it works as expected, but on the other hand I see your point that you just expect it to work.

I'm not sure we should run an install whenever the project is started because I think this would result in a longer boot time, and you don't need to install it every time you start it, but only the first time. The same applies for Composer imo.

When you add a dependency I think it's fair to expect the user to run an install manually.

On a personal project I've made NPM install run only if the node_modules folder is not there. It has the advantage of installing dependencies the first time but not subsequently. But this means we need to use our own entrypoint so I'd rather avoid it.

Maybe this should be more clear in the documentation/script then?

@mr-feek
Copy link
Contributor Author

mr-feek commented Jul 6, 2020

@AdrienPoupa I believe npm install should be a noop if the node_modules is present (which is why I didn't use npm ci).
I understand your concerns about not necessarily wanting to always invoke it.

However, the npm container provides the correct runtime and environment for setting up/running the project. If we require end users to npm install before starting their containers, that means that we require them to manually install the correct versions of node/npm on their host device, no?


I'm no docker expert, but isn't there a concept of "initialization containers"? Maybe that is what we are looking for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants