수강이 제한됩니다.
다른 수강생들이 자주 물어보는 질문이 궁금하신가요?
- 미해결Node.js 교과서 - 기본부터 프로젝트 실습까지
이 코드좀 봐주실수 있나요... 왜 에러가 났는지 모르겠네요 ..
const util = require('util') fs.readFile('./text.txt', (err,data) => { if(err){ throw err; } console.log("_______________________________________________________________________________________________________________________"); console.log(" promisefy 시작"); console.log("1 번 ",data.toString()); } ) const num1 = util.promisify(fs.readFile); fs.readFile('./text.txt', (err,data) => { if(err){ throw err; } console.log("2 번 ",data.toString()); }) const num2 = util.promisify(fs.readFile) fs.readFile('./text.txt', (err,data) => { if(err){ throw err; } console.log("3 번 ",data.toString()); console.log("끝"); console.log("_______________________________________________________________________________________________________________________"); }) const num3 = util.promisify(fs.readFile) num1() .then ((msg) =>{ console.log(msg) return num2() }) .then((msg)=> { console.log(msg) return num3() }) .then((msg)=> { console.log(msg) }) .catch((err)=>{ console.log(err) }) async function z4() { try{ console.log('async 시작!!!') const fs1 = await num1() console.log(fs1) const fs2 = await num2() console.log(fs2) const fs3 = await num3() console.log(fs3) }catch(err){ console.error(err) } } z4() promisify로 잘 작동은 하는데요 .. 문제는 async 을 돌리면 에러가 뜨더라구요 TypeError [ERR_INVALID_CALLBACK]: Callback must be a function. Received undefined 뜨는데 왜그런지 잘 모르겠네요... 도와주시면 감사하겠습니다...
- 미해결Node.js 교과서 - 기본부터 프로젝트 실습까지
간단한 질문이요..
const j = (a)=>{ if(a%2){ console.log("odd") return true }else{ console.log("even") return true } } j(3) 궁금한게 있는데여 if(a%2) 이렇게 컨디션을 지정해서 나머지가 나오면 true 값이 나오는건가요, 저는 자바를 해왔엇는데 자바 같은 경우는 if(a%2!=0) 이런식으로 !=0을 붙여주어서 값을 지정해서 나머지가 있는지 확인하는데 자바스크립트에서는 아닌가보네요? 혹시 이거 말고도 이와 같은 유형있으면 좀 알려주실 수 있나여?
- 미해결Node.js 교과서 - 기본부터 프로젝트 실습까지
VS code 쓰는데요
async func() => { }func(); func() => 이 부분에서 빨간줄로 에러가 납니다. 세미콜론 붙이라고 하는데, 왜그런지 모르겠네요...
- 해결됨Node.js 교과서 - 기본부터 프로젝트 실습까지
여기까지 마친후 해시태그 검색을 하면.. 오류가납니다.
/lecture/nodebird/views/main.pug:35 33| .twit-img 34| img(src=twit.img alt='섬네일') > 35| -const like = user && twit && twit.Liker.map(l => l.id).includes(user.id); 36| if user && !like 37| button.like 좋아요 38| else if user && like Cannot read property 'map' of undefined TypeError: /Applications/MAMP/htdocs/lecture/nodebird/views/main.pug:35 33| .twit-img 34| img(src=twit.img alt='섬네일') > 35| -const like = user && twit && twit.Liker.map(l => l.id).includes(user.id); 36| if user && !like 37| button.like 좋아요 38| else if user && like Cannot read property 'map' of undefined이렇게 발생하는데.. 어떻게 고쳐야하나요 ㅠㅠ
- 해결됨Node.js 교과서 - 기본부터 프로젝트 실습까지
콜백함수가 (err, value)의 형태가 아닌 경우 promisify()를 쓸 수 있나요?
이런 경우에는 그냥 new Promise()를 만들어서 리턴해야 하는지, 아니면 다른 대안이 있는지 궁금합니다.
- 미해결Node.js 교과서 - 기본부터 프로젝트 실습까지
시퀄라이즈 Unknown column 'name' in 'field list'
강의의 시퀄라이즈 내용 코드를 그대로 가져왔는데 이런 에러가 나오는데, 어디서 잘못된건가요?
- 해결됨Node.js 교과서 - 기본부터 프로젝트 실습까지
500 server error
제로초님과 동일한 코드를 사용하였는데 /test시 Request failed with status code 500에러가 뜹니다. 어디서 오류가 난걸까요...? Request failed with status code 500 at createError (\node_modules\axios\lib\core\createError.js:16:15) at settle (\node_modules\axios\lib\core\settle.js:17:12) at IncomingMessage.handleStreamEnd (\node_modules\axios\lib\adapters\http.js:237:11) at IncomingMessage.emit (events.js:194:15) at endReadableNT (_stream_readable.js:1125:12) at process._tickCallback (internal/process/next_tick.js:63:19)
- 미해결Node.js 교과서 - 기본부터 프로젝트 실습까지
이 에러에대해 알려주실수있나요?
Error: Failed to lookup view "main" in views directory 이 에러는 routes에 문제인가요 아니면 views 폴더 쪽에 문제인가요? 그리고 pug 문법대신에 ejs 문법을 사용하려고합니다. app js 에서 pug -> ejs 바꾸면 되는건가요?
- 미해결Node.js 교과서 - 기본부터 프로젝트 실습까지
비구조화 할당 강의에서 질문드립니다.
비구조화 할당하시구 getCandy()라고 호출하시는데 getCandy라고 호출하셔야 되는거 아닌가요? 제가 직접해보니 그런거 같아서 여쭈어봅니다.
- 미해결Node.js 교과서 - 기본부터 프로젝트 실습까지
11. API 서버 만들기
안녕하세요. 제로초님 위와같은 오류가 발생하여 질문남기게 되었습니다. 코드는 아래와 같이 고쳤는데 engine오류가 발생합니다. 아래 코드에서 잘못된 점이 있다면 알려주심 감사하겠습니다. router.get('/', (req, res, next) => { if( req.user ) { User.findOne({ where: { id: req.user.id }, include: { models: Domain }, }) .then((user) => { res.render('login', { user, loginError: req.flash('loginError'), domains: user && user.domains, }); }) .catch((error) => { console.error(error); next(error); }) } else { // res.json('loginError'); res.render('login', { user: [], loginError: req.flash('loginError'), domains: [], }); } });
- 해결됨Node.js 교과서 - 기본부터 프로젝트 실습까지
책 9장 내용 카카오 로그인하기 오류!
안녕하세요 제로초님. 강의 잘 듣고 있습니다. 10장에서 여러번 막히네요ㅜㅜ.. 로컬 로그인까지는 성공했는데, 카카오톡 로그인을 하려고 보니 '카카오톡' 버튼을 누르자마자 아래와 같은 오류가 뜨네요. 작성한 코드와 워크벤치까지 확인했는데 STRING(VARCHAR)로 잘 뜨는데 무슨 문제일까요..?
- 미해결Node.js 교과서 - 기본부터 프로젝트 실습까지
sequelize 관계설정하기 질문입니다.
강의를 듣고 작성한 코드인데 이런 에러가 나옵니다. 어디에 문제가 있는걸까요...?
- 미해결Node.js 교과서 - 기본부터 프로젝트 실습까지
this 질문
var relationship1 = { name: "zero", friends: ["nero", "hero", "xero"], logFriends: function() { var that = this; this.friends.forEach(function(friend) { console.log(that.name, friend); }); } }; relationship1.logFriends(); 여기서 this를 that에 대입을 하는 이유가 뭔가요? logFriends 안에서 콘솔로그로 this를 보니까 Object[global] ~~ 이런게 뜨던데 그럼 this를 that에 대입해도 똑같은 값이 대입되어야 하지 않나요? 그런데 that에 대입을 하고 콘솔로그해보면 relationship1의 객체가 나오네요.. 이유가 궁금합니다.
- 미해결Node.js 교과서 - 기본부터 프로젝트 실습까지
Unhandled rejection SequelizeConnectionError: Client does not support authentication protocol requested by server; consider upgrading MySQL client
nodemon으로 서버 실행시 해당 문제가 자꾸 발생합니다. 누군가는 mysqlbench에서 root 비밀번호를 다시 설정하는쿼리문을 쏴주면 해결된다고 구글링에는 나오지만, 그렇게 root 유저의 비밀번호를 ''(null)로 설정해도 오류가 계속 생기네요. 해결책이 있을까요? ㅠㅠ
- 미해결Node.js 교과서 - 기본부터 프로젝트 실습까지
10장 4절 오류 메시지
안녕하세요? API <-> Call 간에 다음과 같은 오류 메시지가 발생하네요... web(localhost:8003/test)오류 메시지 :: Error: secret option required for sessions at session (C:\Users\pleoc\OneDrive\Documents\Start_up\javawork\nodebird-call\node_modules\express-session\index.js:200:12) at Layer.handle [as handle_request] (C:\Users\pleoc\OneDrive\Documents\Start_up\javawork\nodebird-call\node_modules\express\lib\router\layer.js:95:5).................console terminal Message ::[nodemon] starting `node app.js` express-session deprecated req.secret; provide secret option app.js:18:9 8003 '번 포트에서 대기중' GET /test 500 621.475 ms - 1444 express-session option 문제인 것 같은데, 도움을 받을 수있을까요?감사합니다.
- 해결됨Node.js 교과서 - 기본부터 프로젝트 실습까지
9. CLI 프로그램 만들기
안녕하세요. 좋은 강의 해주셔서 감사합니다. 9장 첫 시작부터 막혀서 질문드립니다. npm i -g로 패키지를 잘 설치해서 제로초님과 같은 결과를 받았는데도 cli 를 쳐보면 제로초님과 같은 index.js 파일이 뜨지 않고 변수값을 요청합니다. 어떻게 해야할까요?
- 미해결Node.js 교과서 - 기본부터 프로젝트 실습까지
return 여부
res.redirect('/'); 와 같은 처리를 해줄 때 return을 해주는지 여부가 중요한가요?
- 미해결Node.js 교과서 - 기본부터 프로젝트 실습까지
pug 파일을 올려주실 수 없나요?
안녕하세요? 강의를 따라가고있는데, TypeError: C:\Users\pleoc\OneDrive\Documents\Start_up\javawork\NodeBird_old\views\main.pug:36 34| .twit-img 35| img(src=twit.img alt='섬네일') > 36| -const like = user && twit && twit.Liker.map(l => l.id).includes(user.id); 37| if user && !like 38| button.like 좋아요 39| else if user && like이런 오류가 계속 뜨는군요.. github에는 수정한 pug 파일이 없어서 가능하시면올려주시면 도움이 되겠습니다.감사합니다.
- 미해결Node.js 교과서 - 기본부터 프로젝트 실습까지
질문4번 다시올립니다~!
routes/index.js 파일에서 const { User } = require('../models') 이렇게 불러와서 User.findAll()을 하잖아요? 제가 User에 뭐가 들어있는지 몰라서 콘솔을 찍어봤더니 웹스톰 터미널에 아래와 같이 찍혔습니다. class extends Model {} 그래서 User에 들어있는 값이 정확히 무엇인지 모르겠습니다ㅠㅠ 비구조화 할당으로 받는거보니 객체인거같긴한데... 무엇이 들어있는건가요? 그리고 User.findAll()하면 유저에 대한 테이블에 있는 정보가 배열로 불러와지나요? 불러온 정보가 .then 내부의 users 매개변수로 들어가는 것은 이해를 했는데 이전 과정이 살짝 이해가 안갔습니다!
- 미해결Node.js 교과서 - 기본부터 프로젝트 실습까지
mysql 8.0 사용하시는분들은
아마 이 에러가 날겁니다. ERROR: Client does not support authentication protocol requested by server; consider upgrading MySQL client 스텍오버플로에서 찾아본결과 워크밴치에서 ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '스키마password' 실행시키시면 에러없이 진행 가능하실거에요.