Cannot start the server
tunggnu opened this issue · 6 comments
Hello,
I cannot make the server start. I'm using a fresh Ubuntu 18.04 with node version 10.22.1 and npm version 6.14.6. All the commands that I have run are:
npm install -g bunyan gulp@4
cd /js
git clone https://github.com/javascript-tutorial/server
git clone https://github.com/javascript-tutorial/engine server/modules/engine
cd /js
git clone https://github.com/javascript-tutorial/en.javascript.info
cd /js/server
npm install
./edit en
All commands ran successfully except for the last one. I got the following messages:
[03:51:53] Using gulpfile /js/server/gulpfile.js
[03:51:53] Starting 'edit'...
[03:51:53] Starting 'webpack'...
[03:51:53] Starting 'engine:koa:tutorial:importWatch'...
[03:51:53] Starting 'livereload'...
[03:51:53] Starting 'server'...
(node:19713) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
Livereload server listening
... Uhoh. Got error listen EADDRINUSE: address already in use :::35729 ...
Error: listen EADDRINUSE: address already in use :::35729
at Server.setupListenHandle [as _listen2] (net.js:1280:14)
at listenInCluster (net.js:1328:12)
at Server.listen (net.js:1415:7)
at Server.listen (/js/server/node_modules/tiny-lr/src/server.js:264:19)
at Function.exports.listen (/js/server/node_modules/gulp-livereload/index.js:97:18)
at module.exports (/js/server/tasks/livereload.js:12:14)
at /js/server/modules/engine/gulp/requireModuleTasks.js:11:12
at taskWrapper (/js/server/node_modules/undertaker/lib/set-task.js:13:15)
at bound (domain.js:402:14)
at runBound (domain.js:415:12)
at asyncRunner (/js/server/node_modules/async-done/index.js:55:18)
at process._tickCallback (internal/process/next_tick.js:61:11)
You already have a server listening on 35729
You should stop it and try again.
[03:51:55] 'server' errored after 1.79 s
[03:51:55] Error: Cannot find module 'csrf'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (/js/server/modules/engine/koa/application.js:23:14)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (/js/server/modules/engine/koa/app.js:6:21)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (/js/server/tasks/server.js:1:11)
at Module._compile (internal/modules/cjs/loader.js:778:30)
[03:51:55] 'edit' errored after 1.8 s
The /js folder contains en.javascript.info and server.
Please help me. I need this server software to verify the result of merging the latest codes from the en.javascript.info repository to the vi.javascript.info repository.
I updated package.json
Please reinstall modules and try again.
I have deleted the /js/server folder and cloned the server and engine repositories again.
Here is the output of the npm install command:
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated request-promise@4.2.6: request-promise has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
npm WARN deprecated flat@4.1.0: Fixed a prototype pollution security issue in 4.1.0, please upgrade to ^4.1.1 or ^5.0.1.
npm WARN deprecated browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated [156/194]
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
> dtrace-provider@0.8.8 install /js/server/node_modules/dtrace-provider
> node-gyp rebuild || node suppress-error.js
make: Entering directory '/js/server/node_modules/dtrace-provider/build'
TOUCH Release/obj.target/DTraceProviderStub.stamp
make: Leaving directory '/js/server/node_modules/dtrace-provider/build'
> nodejieba@2.4.1 install /js/server/node_modules/nodejieba
> node-pre-gyp install --fallback-to-build
node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Tried to download(404): https://github.com/yanyiwu/nodejieba/releases/download/2.4.1/nodejieba-v2.4.1-node-v64-linux-x64.tar.gz
node-pre-gyp WARN Pre-built binaries not found for nodejieba@2.4.1 and node@10.22.1 (node-v64 ABI, glibc) (falling back to source compile with node-gyp)
make: Entering directory '/js/server/node_modules/nodejieba/build'
CXX(target) Release/obj.target/nodejieba/lib/index.o
CXX(target) Release/obj.target/nodejieba/lib/nodejieba.o
SOLINK_MODULE(target) Release/obj.target/nodejieba.node
COPY Release/nodejieba.node
make: Leaving directory '/js/server/node_modules/nodejieba/build'
> core-js@2.6.11 postinstall /js/server/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
> https://opencollective.com/core-js [127/194]
> https://www.patreon.com/zloirock
Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)
> nodemon@1.19.4 postinstall /js/server/node_modules/nodemon
> node bin/postinstall || exit 0
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN notsup Unsupported engine for watchpack-chokidar2@2.0.0: wanted: {"node":"<8.10.0"} (current: {"node":"10.22.1","npm":"6.14.6"})
npm WARN notsup Not compatible with your version of node/npm: watchpack-chokidar2@2.0.0
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules/watchpack/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.1 (node_modules/mocha/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN autoprefixer@10.0.1 requires a peer of postcss@^8.1.0 but none is installed. You must install peer dependencies yourself.
npm WARN postcss-loader@4.0.4 requires a peer of postcss@^7.0.0 || ^8.0.1 but none is installed. You must install peer dependencies yourself.
added 1308 packages from 742 contributors and audited 1315 packages in 38.24s
32 packages are looking for funding
run `npm fund` for details
found 8 vulnerabilities (4 moderate, 4 high)
run `npm audit fix` to fix them, or `npm audit` for details
The ./edit en command ran for several seconds then stopped:
[09:56:54] Using gulpfile /js/server/gulpfile.js
[09:56:54] Starting 'edit'...
[09:56:54] Starting 'webpack'...
[09:56:54] Starting 'engine:koa:tutorial:importWatch'...
[09:56:54] Starting 'livereload'...
[09:56:54] Starting 'server'...
(node:27179) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
... Uhoh. Got error listen EADDRINUSE: address already in use :::35729 ...
Error: listen EADDRINUSE: address already in use :::35729
at Server.setupListenHandle [as _listen2] (net.js:1280:14)
at listenInCluster (net.js:1328:12)
at Server.listen (net.js:1415:7)
at Server.listen (/js/server/node_modules/tiny-lr/src/server.js:264:19)
at Function.exports.listen (/js/server/node_modules/gulp-livereload/index.js:97:18)
at module.exports (/js/server/tasks/livereload.js:12:14)
at /js/server/modules/engine/gulp/requireModuleTasks.js:11:12
at taskWrapper (/js/server/node_modules/undertaker/lib/set-task.js:13:15)
at bound (domain.js:402:14)
at runBound (domain.js:415:12)
at asyncRunner (/js/server/node_modules/async-done/index.js:55:18)
at process._tickCallback (internal/process/next_tick.js:61:11)
You already have a server listening on 35729
You should stop it and try again.
Livereload server listening
09:56:56.282Z INFO application: Boot complete
09:56:56.321Z INFO tutorialImporter: sync ../en.javascript.info/1-js
/js/en.javascript.info/1-js /js/en.javascript.info
09:56:56.321Z INFO tutorialImporter: syncFolder /js/en.javascript.info/1-js
09:56:56.322Z INFO tutorialImporter: syncFolder /js/en.javascript.info/1-js/01-getting-started
09:56:56.323Z INFO tutorialImporter: syncArticle /js/en.javascript.info/1-js/01-getting-started/1-intro
09:56:56.353Z INFO application: Server is listening localhost:3000
[09:56:56] Finished 'server' after 1.93 s
09:56:56.375Z INFO tutorialImporter: importImage /js/en.javascript.info/1-js/01-getting-started/1-intro/limitations.svg to /js/server/public/en/article/intro
09:56:56.385Z INFO tutorialImporter: syncArticle /js/en.javascript.info/1-js/01-getting-started/2-manuals-specifications
...
livereload: listen on change public/pack/**/*.*,!public/pack/head.js
09:56:57.202Z INFO tutorialImporter: syncArticle /js/en.javascript.info/1-js/02-first-steps/10-ifelse
09:56:57.353Z INFO tutorialImporter: importImage /js/en.javascript.info/1-js/02-first-steps/10-ifelse/2-check-standard/ifelse_task2.svg to /js/server/public/en/task/check-standard
...
(node:27179) [DEP0097] DeprecationWarning: Using a domain property in MakeCallback is deprecated. Use the async_context variant of MakeCallback or the AsyncResource class instead.
09:57:02.136Z INFO tutorialImporter: syncView: dir /js/en.javascript.info/1-js/03-code-quality/05-testing-mocha/pow-3.view
09:57:02.147Z INFO tutorialImporter: syncView: dir /js/en.javascript.info/1-js/03-code-quality/05-testing-mocha/pow-4.view
./tmp/en/frontpage.styl
[09:57:02] 'webpack' errored after 7.77 s
[09:57:02] Error: ./tmp/en/frontpage.styl
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/postcss-loader/dist/cjs.js):
ValidationError: Invalid options object. PostCSS Loader has been initialized using an options object that does not match the API schema.
- options has an unknown property 'plugins'. These properties are valid:
object { postcssOptions?, execute?, sourceMap? }
at validate (/js/server/node_modules/postcss-loader/node_modules/schema-utils/dist/validate.js:104:11)
at Object.loader (/js/server/node_modules/postcss-loader/dist/index.js:43:29)
at runLoaders (/js/server/node_modules/webpack/lib/NormalModule.js:316:20)
at /js/server/node_modules/loader-runner/lib/LoaderRunner.js:367:11
at /js/server/node_modules/loader-runner/lib/LoaderRunner.js:233:18
at process._tickCallback (internal/process/next_tick.js:68:7)
at formatError (/js/server/node_modules/gulp/node_modules/gulp-cli/lib/versioned/^4.0.0/format-error.js:21:10)
at Gulp.<anonymous> (/js/server/node_modules/gulp/node_modules/gulp-cli/lib/versioned/^4.0.0/log/events.js:33:15)
at Gulp.emit (events.js:203:15)
at Gulp.EventEmitter.emit (domain.js:448:20)
at Object.error (/js/server/node_modules/undertaker/lib/helpers/createExtensions.js:61:10)
at handler (/js/server/node_modules/now-and-later/lib/map.js:50:14)
at f (/js/server/node_modules/once/once.js:25:25)
at f (/js/server/node_modules/once/once.js:25:25)
at tryCatch (/js/server/node_modules/async-done/index.js:24:15)
at done (/js/server/node_modules/async-done/index.js:40:12)
at onError (/js/server/node_modules/async-done/index.js:51:5)
[09:57:02] 'edit' errored after 7.77 s
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/postcss-loader/dist/cjs.js):
ValidationError: Invalid options object. PostCSS Loader has been initialized using an options object that does not match the API schema.
- options has an unknown property 'plugins'. These properties are valid:
object { postcssOptions?, execute?, sourceMap? }
at validate (/js/server/node_modules/postcss-loader/node_modules/schema-utils/dist/validate.js:104:11)
at Object.loader (/js/server/node_modules/postcss-loader/dist/index.js:43:29)
at runLoaders (/js/server/node_modules/webpack/lib/NormalModule.js:316:20)
at /js/server/node_modules/loader-runner/lib/LoaderRunner.js:367:11
at /js/server/node_modules/loader-runner/lib/LoaderRunner.js:233:18
at process._tickCallback (internal/process/next_tick.js:68:7)
Try again please (pull both repos), I updated a bit more.
Also, make sure you don't run the server twice, it seems the port for livereload is occupied.
You already have a server listening on 35729
Might be another instance of this server or a completely different editing stuff running.
I already know about the message You already have the server listening on 35729 but I believe it is a software bug related to gulp or something else.
I deleted the /js/server folder, cloned the server and engine repositories, and ran the npm install command again. I also checked the available ports to ensure no processes were listening on 35729.
sudo netstat -lnptu
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 475/systemd-resolve
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 673/sshd
tcp6 0 0 :::22 :::* LISTEN 673/sshd
udp 0 0 127.0.0.53:53 0.0.0.0:* 475/systemd-resolve
udp 0 0 139.180.156.72:68 0.0.0.0:* 898/systemd-network
This time I still got a complaint about the port 35729 but the command ./edit en ran successfully. Thank you.
By the way, after reviewing the other issues in this repo, I found that many others failed to start the server either. So if possible, please create a docker image so that everyone can avoid this kind of error.
Is it working now?
Yes, it is working. Thank you.