Skip to content
New issue

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

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

Already on GitHub? # to your account

Container with site exited #2

Closed
sibvlogru opened this issue Feb 26, 2020 · 2 comments
Closed

Container with site exited #2

sibvlogru opened this issue Feb 26, 2020 · 2 comments

Comments

@sibvlogru
Copy link

2020-02-26T03:04:41.204754799Z

mess-with-node-in-docker@1.0.0 dev /usr/src/app
NODE_OPTIONS='--inspect=0.0.0.0' next
2020-02-26T03:04:41.204795533Z
sh: next: not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! mess-with-node-in-docker@1.0.0 dev: NODE_OPTIONS='--inspect=0.0.0.0' next
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the mess-with-node-in-docker@1.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
2020-02-26T03:04:41.233126107Z
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-02-26T03_04_41_225Z-debug.log

@kconner
Copy link
Owner

kconner commented Feb 29, 2020

next: not found suggests that node modules are not installed. If npm install is successful, it will place next in node_modules/.bin.

It looks like npm run dev is trying to run and failing.

If you ran this command yourself outside of Docker, you'd need to use npm install first from the same folder as package.json.

If instead you are running docker-compose up, npm install should have been run by docker-compose's use of docker build before it brings up the container and invokes npm run build. You'll want to look at the build log to see whether it succeeded, and if not, why not. If the build log isn't still available to you, you can locate the docker image with docker image ls, delete it with docker image rm, and then docker-compose up should build it again next time.

@kconner kconner closed this as completed Jun 25, 2022
@jguay
Copy link

jguay commented Mar 7, 2023

I have exact same issue just running docker-compose up -d --build and then docker-compose ps -a (compose v2 syntac) shows both containers could not start so there seems to be a bug (I cloned the GH repo and ran nothing else)

$ docker-compose logs
nextjs-storybook-1  | 
nextjs-site-1       | 
nextjs-site-1       | > mess-with-node-in-docker@1.0.0 dev /usr/src/app
nextjs-site-1       | > NODE_OPTIONS=--inspect=0.0.0.0 next
nextjs-site-1       | 
nextjs-site-1       | sh: next: not found
nextjs-site-1       | npm ERR! file sh
nextjs-site-1       | npm ERR! code ELIFECYCLE
nextjs-site-1       | npm ERR! errno ENOENT
nextjs-site-1       | npm ERR! syscall spawn
nextjs-site-1       | npm ERR! mess-with-node-in-docker@1.0.0 dev: `NODE_OPTIONS=--inspect=0.0.0.0 next`
nextjs-site-1       | npm ERR! spawn ENOENT
nextjs-site-1       | npm ERR! 
nextjs-site-1       | npm ERR! Failed at the mess-with-node-in-docker@1.0.0 dev script.
nextjs-site-1       | npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
nextjs-site-1       | npm WARN Local package.json exists, but node_modules missing, did you mean to install?
nextjs-site-1       | 
nextjs-site-1       | npm ERR! A complete log of this run can be found in:
nextjs-site-1       | npm ERR!     /root/.npm/_logs/2023-03-07T13_33_29_903Z-debug.log
nextjs-storybook-1  | > mess-with-node-in-docker@1.0.0 storybook /usr/src/app
nextjs-storybook-1  | > start-storybook --port 6006 --config-dir .storybook --quiet
nextjs-storybook-1  | 
nextjs-storybook-1  | sh: start-storybook: not found
nextjs-storybook-1  | npm ERR! file sh
nextjs-storybook-1  | npm ERR! code ELIFECYCLE
nextjs-storybook-1  | npm ERR! errno ENOENT
nextjs-storybook-1  | npm ERR! syscall spawn
nextjs-storybook-1  | npm ERR! mess-with-node-in-docker@1.0.0 storybook: `start-storybook --port 6006 --config-dir .storybook --quiet`
nextjs-storybook-1  | npm ERR! spawn ENOENT
nextjs-storybook-1  | npm ERR! 
nextjs-storybook-1  | npm ERR! Failed at the mess-with-node-in-docker@1.0.0 storybook script.
nextjs-storybook-1  | npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
nextjs-storybook-1  | npm WARN Local package.json exists, but node_modules missing, did you mean to install?
nextjs-storybook-1  | 
nextjs-storybook-1  | npm ERR! A complete log of this run can be found in:
nextjs-storybook-1  | npm ERR!     /root/.npm/_logs/2023-03-07T13_33_29_926Z-debug.log

I guess some steps are missing in the documentation or Dockerfile as I would expect docker-compose up -d --build should be enough and given it's docker I assume same behaviour reproducible anywhere

I think this helps because the log reside on a stopped container :

adding volumes for log visibility

  • Adding ./sitenpm:/root/.npm and ./storybooknpm:/root/.npm so we can view the logs on the docker host file system

After this I see logs :

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'dev' ]
2 info using npm@6.10.2
3 info using node@v12.8.1
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle mess-with-node-in-docker@1.0.0~predev: mess-with-node-in-docker@1.0.0
6 info lifecycle mess-with-node-in-docker@1.0.0~dev: mess-with-node-in-docker@1.0.0
7 verbose lifecycle mess-with-node-in-docker@1.0.0~dev: unsafe-perm in lifecycle true
8 verbose lifecycle mess-with-node-in-docker@1.0.0~dev: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/usr/src/app/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/src/app/node_modules/.bin
9 verbose lifecycle mess-with-node-in-docker@1.0.0~dev: CWD: /usr/src/app
10 silly lifecycle mess-with-node-in-docker@1.0.0~dev: Args: [ '-c', 'NODE_OPTIONS=--inspect=0.0.0.0 next' ]
11 info lifecycle mess-with-node-in-docker@1.0.0~dev: Failed to exec dev script
12 verbose stack Error: mess-with-node-in-docker@1.0.0 dev: `NODE_OPTIONS=--inspect=0.0.0.0 next`
12 verbose stack spawn ENOENT
12 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:48:18)
12 verbose stack     at ChildProcess.emit (events.js:203:13)
12 verbose stack     at maybeClose (internal/child_process.js:1021:16)
12 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
13 verbose pkgid mess-with-node-in-docker@1.0.0
14 verbose cwd /usr/src/app
15 verbose Linux 5.15.49-linuxkit
16 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "dev"
17 verbose node v12.8.1
18 verbose npm  v6.10.2
19 error file sh
20 error code ELIFECYCLE
21 error errno ENOENT
22 error syscall spawn
23 error mess-with-node-in-docker@1.0.0 dev: `NODE_OPTIONS=--inspect=0.0.0.0 next`
23 error spawn ENOENT
24 error Failed at the mess-with-node-in-docker@1.0.0 dev script.
24 error This is probably not a problem with npm. There is likely additional logging output above.
25 verbose exit [ 1, true ]

And for storybook :

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'storybook' ]
2 info using npm@6.10.2
3 info using node@v12.8.1
4 verbose run-script [ 'prestorybook', 'storybook', 'poststorybook' ]
5 info lifecycle mess-with-node-in-docker@1.0.0~prestorybook: mess-with-node-in-docker@1.0.0
6 info lifecycle mess-with-node-in-docker@1.0.0~storybook: mess-with-node-in-docker@1.0.0
7 verbose lifecycle mess-with-node-in-docker@1.0.0~storybook: unsafe-perm in lifecycle true
8 verbose lifecycle mess-with-node-in-docker@1.0.0~storybook: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/usr/src/app/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/src/app/node_modules/.bin
9 verbose lifecycle mess-with-node-in-docker@1.0.0~storybook: CWD: /usr/src/app
10 silly lifecycle mess-with-node-in-docker@1.0.0~storybook: Args: [ '-c', 'start-storybook --port 6006 --config-dir .storybook --quiet' ]
11 info lifecycle mess-with-node-in-docker@1.0.0~storybook: Failed to exec storybook script
12 verbose stack Error: mess-with-node-in-docker@1.0.0 storybook: `start-storybook --port 6006 --config-dir .storybook --quiet`
12 verbose stack spawn ENOENT
12 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:48:18)
12 verbose stack     at ChildProcess.emit (events.js:203:13)
12 verbose stack     at maybeClose (internal/child_process.js:1021:16)
12 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
13 verbose pkgid mess-with-node-in-docker@1.0.0
14 verbose cwd /usr/src/app
15 verbose Linux 5.15.49-linuxkit
16 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "storybook"
17 verbose node v12.8.1
18 verbose npm  v6.10.2
19 error file sh
20 error code ELIFECYCLE
21 error errno ENOENT
22 error syscall spawn
23 error mess-with-node-in-docker@1.0.0 storybook: `start-storybook --port 6006 --config-dir .storybook --quiet`
23 error spawn ENOENT
24 error Failed at the mess-with-node-in-docker@1.0.0 storybook script.
24 error This is probably not a problem with npm. There is likely additional logging output above.
25 verbose exit [ 1, true ]

I'll google this further to see if I can fix it (I don't know npm - and I was only after running some next.js application to instrument it with APM solutions) - Edit I found another example which worked ootb after adding docker-compose.yml and Dockerfile

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

No branches or pull requests

3 participants