본문 바로가기

Javascript&Typescript/Node.js10

[Node.js / Error] return process.dlopen(module, path.toNamespacedPath(filename)); Node.js app.js 실행 시 Error return process.dlopen(module, path.toNamespacedPath(filename)); ==> node_modlues 버전이 안맞아서 발생하는 error. rm -rf node_modules npm update 기존의 node_modlues 폴더 삭제 후 업데이트, 그리고 실행하면 잘 된다. 참고 : https://velog.io/@howooke/%EB%B0%B0%ED%8F%AC%EC%8B%9C-%EC%97%90%EB%9F%ACreturn-process.dlopenmodule-path.toNamespacedPathfilename 2024. 4. 8.
[Error] Error: listen EADDRINUSE: address already in use :::5000 5000 포트 사용중인 프로세스 확인 sudo lsof -i :5000 Spotlight 검색 통해 Airplay 수신모드 검색 Airplay 수신모드 해제 5000 포트를 사용중인 프로세스가 없음 참고 : https://velog.io/@jsy7517/Error-listen-EADDRINUSE-address-already-in-use-5000 2024. 1. 10.
[Node.js] Express app.js const express = require("express"); const app = express(); app.listen(5000, () => { console.log("server is listening on port 5000..."); }); const express = require("express"); const app = express(); app.get("/", (req, res) => { res.send("Home Page"); }); app.listen(5000, () => { console.log("server is listening on port 5000..."); }); app.all 모든 메서드(GET, POST, PUT, DELETE 또는 그 외의 것)에 대해 핸들.. 2024. 1. 10.
[Node.js] npm npm init npm init enter 로 default 설정 후 yes package.json 생성됨 { "name": "nodejs-and-expressjs-full-cource", "version": "1.0.0", "description": "", "main": "01-intro.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "author": "", "license": "ISC" } 패키지 추가 package.json 에 추가 됨. { "name": "nodejs-and-expressjs-full-cource", "version": "1.0.0", "description": "", "main": "01-in.. 2024. 1. 7.
[Node.js] module exports / require exports : object - module exports // local const secret = "SUPER SECRET"; // share const john = "john"; const peter = "peter"; // console.log(module); module.exports = { john, peter }; john, peter 의 key name이 같기 때문에 값을 그대로 전달 module 위치 const names = require("./04-names"); - module import const { john, peter } = require("./04-names"); const sayHi = require("./05-utils"); sayHi("susan"); sayHi(joh.. 2024. 1. 6.
[Node.js] 프로젝트의 Directory structure express-generator로 생성한 프로젝트의 Directory structure - package.json application dependency 와 다른 정보 정의 - bin/www application entry point application의 진짜 entry point인 app.js 를 require() 특정 port(default 3000)로 설정된 HTTP서버 설정 서버 연결, 수신 /** * Module dependencies. */ var app = require('../app'); var debug = require('debug')('btc-wallet:server'); var http = require('http'); /** * Get port from environment a.. 2022. 11. 7.