Comments (1)
I traced the issue to lib/serve.js#L15. It works fine if I disable that line that emits the SIGUSR1
signal when restarting.
Also, I was able to fix the restarting behavior in my application by placing this in my server/index.js
file:
process.on('SIGUSR2', () => {});
However, I could not fix custom-server-micro in the same way. With the "fix", rather than crashing on restart it restarts once and then is hung. It's strange, considering I used that example as a reference for using micro/micro-dev with next.js in my app. My app has more going on now, not sure why difference... I'm running these inside a docker container.
Some more info from running it with npm
vs yarn
:
File changed: server.js - Restarting server...
User defined signal 2
npm ERR! code ELIFECYCLE
npm ERR! errno 140
npm ERR! @ dev: `micro-dev --watch server.js`
npm ERR! Exit status 140
npm ERR!
npm ERR! Failed at the @ dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
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 [email protected]
3 info using [email protected]
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle @~predev: @
6 info lifecycle @~dev: @
7 verbose lifecycle @~dev: unsafe-perm in lifecycle true
8 verbose lifecycle @~dev: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/gizmoduck/src/TMP/NEXT/custom-server-micro/node_modules/.bin:/home/gizmoduck/bin:/home/gizmoduck/perl5/bin:/home/gizmoduck/bin:/home/gizmoduck/.yarn/bin:/home/gizmoduck/bin:/home/gizmoduck/perl5/bin:/home/gizmoduck/bin:/home/gizmoduck/.yarn/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
9 verbose lifecycle @~dev: CWD: /home/gizmoduck/src/TMP/NEXT/custom-server-micro
10 silly lifecycle @~dev: Args: [ '-c', 'micro-dev --watch server.js' ]
11 silly lifecycle @~dev: Returned: code: 140 signal: null
12 info lifecycle @~dev: Failed to exec dev script
13 verbose stack Error: @ dev: `micro-dev --watch server.js`
13 verbose stack Exit status 140
13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:285:16)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at EventEmitter.emit (events.js:214:7)
13 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at ChildProcess.emit (events.js:214:7)
13 verbose stack at maybeClose (internal/child_process.js:925:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid @
15 verbose cwd /home/gizmoduck/src/TMP/NEXT/custom-server-micro
16 verbose Linux 4.15.0-38-generic
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "dev"
18 verbose node v8.11.4
19 verbose npm v5.6.0
20 error code ELIFECYCLE
21 error errno 140
22 error @ dev: `micro-dev --watch server.js`
22 error Exit status 140
23 error Failed at the @ dev script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 140, true ]
From the log I notice I'm using node v8.11.4 which seems old... but that was by intention to match the version I have on target devices (Raspberry Pi). I can look into options to upgrade that and see if it has something to do with this issue.
Update: using node v10.13.0, similar behavior although it seems to take longer to restart.
from micro-dev.
Related Issues (20)
- Restore compatibility with micro@canary
- Update chokidar to v3 HOT 1
- Add cli arguments to documentation
- apollo-server-micro floods console with introspection logs HOT 3
- Provide an option to disable the auto copy to clipboard behaviour
- --ignore option not accepting glob HOT 1
- micro with next js restart every time on next compile
- micro-dev restarts on non-source code changes
- Yargs Parser Security Vulnerability
- Update all dependencies HOT 1
- Add ESLint and move to TypeScript
- print name of module file being used on startup.
- Purpose of SIGUSR2 signal? HOT 1
- Not compatible with `micro` v10.x HOT 3
- Windows node debugger: SyntaxError: missing ) after argument list HOT 1
- micro-dev exits on error HOT 3
- UnhandledPromiseRejectionWarning thrown when content-type is not sent HOT 1
- add to readme: how to use custom now.json files with now-env
- Disable console logging? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from micro-dev.