gulp-webserver error occured sometimes - javascript

events.js:85
throw er; // Unhandled 'error' event
^
Error: getaddrinfo ENOTFOUND localhost
at errnoException (dns.js:44:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:94:26)
When I ran 'gulp' command, I met this error, but I don't know how to solve it. I also meet this error when I ran gulp serve command, so I guess this error was caused by gulp-webserver.
My gulp serve task in gulpfile.js is here.
gulp.task('serve', function() {
gulp.src('app/')
.pipe(webserver({
livereload: true,
directoryListening: true,
open: true
}));
});
Please tell me how to solve this problem.

Problem was with hosts file on Mac Yosemite. To correct behavior in /private/etc/hosts was added following line:
127.0.0.1 localhost

Related

Svelte production build error : Prerendering failed with code 1

I received a frontend for a website that I am trying to deploy. Running it locally in development mode works (npm run dev). However, now I am trying to build it for use in production (npm run build) but I am getting the following exception:
file:///Users/stan/IdeaProjects/runespawn/web-frontend/node_modules/#sveltejs/kit/src/core/prerender/prerender.js:50
throw new Error(format_error(details, config));
^
Error: 404 /
at file:///Users/stan/IdeaProjects/runespawn/web-frontend/node_modules/#sveltejs/kit/src/core/prerender/prerender.js:50:11
at save (file:///Users/stan/IdeaProjects/runespawn/web-frontend/node_modules/#sveltejs/kit/src/core/prerender/prerender.js:332:4)
at visit (file:///Users/stan/IdeaProjects/runespawn/web-frontend/node_modules/#sveltejs/kit/src/core/prerender/prerender.js:196:3)
[vite-plugin-svelte-kit] Prerendering failed with code 1
error during build:
Error: Prerendering failed with code 1
at ChildProcess.<anonymous> (file:///Users/stan/IdeaProjects/runespawn/web-frontend/node_modules/#sveltejs/kit/src/exports/vite/index.js:443:15)
at ChildProcess.emit (node:events:513:28)
at Process.ChildProcess._handle.onexit (node:internal/child_process:293:12)
I have found a similar question How can I fix this error when trying to deploy my svelte app on github pages? but in this case the error actually makes it very clear what path is wrong. In my case, I have no idea how I can find the invalid path, Svelte does not tell me where it is.
I have inherited this project from a frontend developer, I am not familiar with Svelte or javascript in general. Any help to troubleshoot would be much appreciated.
Thank you :)
I had the same problem and although I don't think this an ideal solution, ignoring the prerendering errors worked. In your svelte.config.js
/** #type {import('#sveltejs/kit').Config} */
const config = {
kit: {
adapter: adapter({
pages: 'build',
assets: 'build',
fallback: null,
precompress: false
}),
prerender: {
onError: () => {
return "continue";
}
}
}

How do you keep a port open automatically for testing in VS Code web applications?

I'm using Visual Studio Code to launch a server for an web application that uses the following packages: nodemon (automatically restarts server), express, ejs, node.js, lodash, morgan, and mongoose.
Every time I activate the server with the following code in the VS Code terminal nodemon app.js or nodemon start I get an error message informing me the port 3000 (one I use for testing) is already in use. I found a solution to solve this in the windows command prompt by entering npx kill-port 3000 in terminal. But I find this repetitive and annoying doing this every single time I update my app.js server code. Is there a more perminent solution to remove the need to type in the windows command prompt terminal?
Operating System: Windows 10
IDE: Visual Studio Code: Version: 1.66.2 (user setup)
Error info:
node:events:498
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE: address already in use :::3000
at Server.setupListenHandle [as _listen2] (node:net:1330:16)
at listenInCluster (node:net:1378:12)
at Server.listen (node:net:1465:7)
at Function.listen (C:\Users\Gamer\Documents\Visual Studio Code repositories\M06 Tutorial Lessons 8-10\node-crash-course-lesson-8\node_modules\express\lib\application.js:635:24)
at C:\Users\Gamer\Documents\Visual Studio Code repositories\M06 Tutorial Lessons 8-10\node-crash-course-lesson-8\app.js:10:25Emitted 'error' event on Server instance at:
at emitErrorNT (node:net:1357:8)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
code: 'EADDRINUSE',
errno: -4091,
syscall: 'listen',
address: '::',
port: 3000

Emitted Error Event when Upload File in Adonisjs

When I’m trying to upload the file using ali-oss but I find some error here and I don’t understand. That error like this:
events.js:174
throw er; // Unhandled 'error' event
^
Error: ENOENT: no such file or directory, open 'E:\PROJECT\myapp\files\1\uploads\test.jpg'
Emitted 'error' event at:
at lazyFs.open (internal/fs/streams.js:115:12)
at FSReqWrap.args [as oncomplete] (fs.js:140:20)
Someone can help me?

Node JS Random events.js:72 throw er;

I know this has been raised a lot of times on here, other threads suggest that the port is already in use and that's why it crashes.
In this case, it's been running for days, using that port and will randomly crash with this error. It's had the port locked for days with no problems and is literally the only daemon on the server.
We're running on port 3000.
events.js:72
throw er; // Unhandled 'error' event
^
Error: getaddrinfo ESRCH
at errnoException (dns.js:37:11)
at Object.onanswer [as oncomplete] (dns.js:124:16)
Any help would be grateful

stdin.write throws Error: write EPIPE

I'm getting this error when openssl child proccess is trying to write() to local directory.
Connection is closed before write() is called. It isn't connected with the ssl, because I can't even launch example code from nodejs documentation.
What am I missing? Some kind of special rights for nodejs?
Please, can anyone give me a real example how to use childProccess.stdin.write()?
events.js:85
throw er; // Unhandled 'error' event
^
Error: write EPIPE
at exports._errnoException (util.js:746:11)
at Socket._writeGeneric (net.js:690:26)
at Socket._write (net.js:709:8)
at doWrite (_stream_writable.js:301:12)
at writeOrBuffer (_stream_writable.js:288:5)
at Socket.Writable.write (_stream_writable.js:217:11)
at Socket.write (net.js:634:40)
at signManifest (...\node_modules\passbook\lib\pass.js:360:14)
It appeared that i've installed openssl in a wrong way. An error (wrong openssl directory) while execFile(openssl) emitted 'close' event, so write threw EPIPE.
Be careful and add a lot of proper error handlers :)

Categories