Posts
Q&A
front ๋ฐฐํฌ ํ ์ฌ์ดํธ ์ฐ๊ฒฐํ ์ ์์ ๋ฌธ์ ์ง๋ฌธ๋๋ฆฝ๋๋ค.
์ผ๋จ ์ด์ ๋๊ณ ๋ค์ ์คํํด์ ๋ค์ ip ๋ง์ถฐ ์คฌ๊ตฌ์. pm2๊ฐ front ์ชฝ์ ์ ๋๋ก ์ค์น๊ฐ ์๋๊ฑฐ๊ฐ์์ git pull ํ๊ณ build ํ์์ต๋๋ค. ๊ทผ๋ฐ node_moules๊ฐ ๊ผฌ์ธ๊ฑฐ๊ฐ์์ ์ฐ๋ถํฌ front ์ชฝ node_moules ํ๊ณ package.json.lock ๋ ๋ฆฌ๊ณ ๊ธฐ์กด ์๋ package.json์ผ๋ก npm i ํ npm run build ํ๋๊น ์๋ฌ ๋ก๊ทธ๊ฐ ์ฌ๋ผ์ค๋ค์. ์๋์ ๊ฐ์ ์๋ฌ์ธ๋ฐ ํ์ธ ๋ถํ๋๋ฆฝ๋๋ค. sudo npx pm2 list ์๋ก๊ณ ์นจ ํ์ ์ซ์๋ ์ด๋ฌํฉ๋๋ค. (์ฌ์ง) ์ .. ์ด์ chrome ์๋ฌ๋ 13.124.181.244 ์๋ฌ๋ pending ๋๋ฉด์ connection_refused ์ ๋๋ค.. ๋ฌผ๋ก ์ง๊ธ front ip๋ ๋ค๋ฅธ๊ฑฐ๋ก ๋ฐ๊ปด์์ต๋๋ค. (์ฌ์ง) ๋ค์ ํด๋ก ๋ฐ๊ณ ์งํํ๋๊ฒ ์ข์๊น์.. ? 0|npm | at internal/main/run_main_module.js:17:47 { 0|npm | code: 'MODULE_NOT_FOUND', 0|npm | requireStack: [] 0|npm | } 0|npm | internal/modules/cjs/loader.js:892 0|npm | throw err; 0|npm | ^ 0|npm | 0|npm | Error: Cannot find module '/home/ubuntu/.npm/_npx/3296/lib/node_modules/pm2/lib/ProcessContainerFork.js' 0|npm | at Function.Module._resolveFilename (internal/modules/cjs/loader.js:889:15) 0|npm | at Function.Module._load (internal/modules/cjs/loader.js:745:27) 0|npm | at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12) 0|npm | at internal/main/run_main_module.js:17:47 { 0|npm | code: 'MODULE_NOT_FOUND', 0|npm | requireStack: [] 0|npm | } 0|npm | internal/modules/cjs/loader.js:892 0|npm | throw err; 0|npm | ^ 0|npm | 0|npm | Error: Cannot find module '/home/ubuntu/.npm/_npx/3296/lib/node_modules/pm2/lib/ProcessContainerFork.js' 0|npm | at Function.Module._resolveFilename (internal/modules/cjs/loader.js:889:15) 0|npm | at Function.Module._load (internal/modules/cjs/loader.js:745:27) 0|npm | at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12) 0|npm | at internal/main/run_main_module.js:17:47 { 0|npm | code: 'MODULE_NOT_FOUND', 0|npm | requireStack: [] 0|npm | } 0|npm | internal/modules/cjs/loader.js:892 0|npm | throw err; 0|npm | ^ 0|npm | 0|npm | Error: Cannot find module '/home/ubuntu/.npm/_npx/3296/lib/node_modules/pm2/lib/ProcessContainerFork.js' 0|npm | at Function.Module._resolveFilename (internal/modules/cjs/loader.js:889:15) 0|npm | at Function.Module._load (internal/modules/cjs/loader.js:745:27) 0|npm | at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12) 0|npm | at internal/main/run_main_module.js:17:47 { 0|npm | code: 'MODULE_NOT_FOUND', 0|npm | requireStack: [] 0|npm | } 0|npm | internal/modules/cjs/loader.js:892 0|npm | throw err; 0|npm | ^ 0|npm | 0|npm | Error: Cannot find module '/home/ubuntu/.npm/_npx/3296/lib/node_modules/pm2/lib/ProcessContainerFork.js' 0|npm | at Function.Module._resolveFilename (internal/modules/cjs/loader.js:889:15) 0|npm | at Function.Module._load (internal/modules/cjs/loader.js:745:27) 0|npm | at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12) 0|npm | at internal/main/run_main_module.js:17:47 { 0|npm | code: 'MODULE_NOT_FOUND', 0|npm | requireStack: [] 0|npm | } 0|npm | internal/modules/cjs/loader.js:892 0|npm | throw err; 0|npm | ^ 0|npm | 0|npm | Error: Cannot find module '/home/ubuntu/.npm/_npx/3296/lib/node_modules/pm2/lib/ProcessContainerFork.js' 0|npm | at Function.Module._resolveFilename (internal/modules/cjs/loader.js:889:15) 0|npm | at Function.Module._load (internal/modules/cjs/loader.js:745:27) 0|npm | at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12) 0|npm | at internal/main/run_main_module.js:17:47 { 0|npm | code: 'MODULE_NOT_FOUND', 0|npm | requireStack: [] 0|npm | } 0|npm | internal/modules/cjs/loader.js:892 0|npm | throw err; 0|npm | ^ 0|npm | 0|npm | Error: Cannot find module '/home/ubuntu/.npm/_npx/3296/lib/node_modules/pm2/lib/ProcessContainerFork.js' 0|npm | at Function.Module._resolveFilename (internal/modules/cjs/loader.js:889:15) 0|npm | at Function.Module._load (internal/modules/cjs/loader.js:745:27) 0|npm | at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12) 0|npm | at internal/main/run_main_module.js:17:47 { 0|npm | code: 'MODULE_NOT_FOUND', 0|npm | requireStack: [] 0|npm | } 0|npm | internal/modules/cjs/loader.js:892 0|npm | throw err; 0|npm | ^ 0|npm | 0|npm | Error: Cannot find module '/home/ubuntu/.npm/_npx/3296/lib/node_modules/pm2/lib/ProcessContainerFork.js' 0|npm | at Function.Module._resolveFilename (internal/modules/cjs/loader.js:889:15) 0|npm | at Function.Module._load (internal/modules/cjs/loader.js:745:27) 0|npm | at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12) 0|npm | at internal/main/run_main_module.js:17:47 { 0|npm | code: 'MODULE_NOT_FOUND', 0|npm | requireStack: [] 0|npm | } 0|npm | internal/modules/cjs/loader.js:892 0|npm | throw err; 0|npm | ^ 0|npm | 0|npm | Error: Cannot find module '/home/ubuntu/.npm/_npx/3296/lib/node_modules/pm2/lib/ProcessContainerFork.js' 0|npm | at Function.Module._resolveFilename (internal/modules/cjs/loader.js:889:15) 0|npm | at Function.Module._load (internal/modules/cjs/loader.js:745:27) 0|npm | at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12) 0|npm | at internal/main/run_main_module.js:17:47 { 0|npm | code: 'MODULE_NOT_FOUND', 0|npm | requireStack: [] 0|npm | }
- 0
- 2
- 459
Q&A
profile.js ๊ด๋ จ ssr ์ ์ฉ ์ง๋ฌธ ์์ต๋๋ค.
404์๋ฌ๋ getSeverSideProps์ผ๋ก ์ ๋ถ ๋ด๋ ธ์๋ ์ฌ๋ผ์ก๋๋ฐ ํด๊ฒฐ์ด ์๋ฌ๋ค๋ ๋ด์ฉ์ด์๊ตฌ์. ๋ค์์ฌ๋ฆฌ๋ฉด ์๊ธด๋ค๋ ๋ด์ฉ์ด์์ต๋๋ค. ์ผ๋จ ๋ค์ ํ์ธํ์ฌ ์์ ํ์์ต๋๋ค. back ๋ผ์ฐํฐ ๋ฌธ์ ๊ฐ ์์ธ์ธ๊ฑฐ ๊ฐ๊ตฌ์. ๋ฌธ์ ๊ฐ ๋ผ์ฐํฐ ์์์ ๋ผ์ฐํฐ ํ๋ผ๋ฉํฐ๊ฐ ์๋ชป๋์ด ์ธ์์ด ์๋ชป๋๊ฒ ์๋๊ฐ ์ถ์ต๋๋ค. ์ค๋ฅ์์ผ๋ก๋ about.js ๋ง๋ค๋ LOAD_USER_REQUEST์ชฝAPI ์๋ฌ๋ฅผ ๋ฟ๊ธธ๋... ์ด์ํ๋ค ์ถ์ด์ back user ๋ผ์ฐํฐ์ชฝ์ ๊ณ์ ํ์ธํ๊ตฌ์.. ๋ผ์ฐํฐ ํ๋ผ๋ฉํฐ๊ฐ ์๋ชป๋ ๋ฌธ์ ๋ GET /user/:id๋ก ๋๊ธฐ๋ method๊ฐ GET /user/:useId๋ก ๋์ด์์๊ณ .. where ๋ก ๋๊ธฐ๋ ์กฐ๊ฑด๋ req.params.useId๋ก ๋์ด์์๊ณ ์. ๋ ๋ผ์ฐํฐ ์์ ๋ฌธ์ ๋ GET /user ๋ณด๋ค GET /user/:id ์ด๊ฒ ๋ ์์ ์์ด์ ๊ทธ๋ฐ๊ฑฐ ๊ฐ๊ธฐ๋ํ๊ตฌ์... req.params.id๋ก followings์ ๋๊ธฐ๋๋ผ๊ณ ์;; ํน์ console.log ๋ง๊ณ ssr์ฌ์ฉ์์ back api ์ ๋ฌ์์ debugger๋ breakpoint๋ก ํ์ธ ํ ์ ์๋ ๋ฐฉ๋ฒ๋ ์์๊น์ ?
- 1
- 2
- 303
Q&A
Cannot read property 'data' of undefined
์ ๋ ์ด๊ฑฐ ์๋ฌ ๋จ๊ณ ๋์ ์ ์ค๋ฅ๋ฉด ๋ฌด์กฐ๊ฑด saga์ชฝ์ธ๋ฐ ์ฝ๋์ชฝ ํ์ฐธ ๋ณด๋ค๊ฐ call import ๋น ์ก๋ค์ ํ;;;;;;;; ์ฝ์ง์์ฒญํ๋ค์..
- 0
- 3
- 655
Q&A
Warning ๋จ๋๊ฑฐ ๊ด๋ จํ์ฌ ์ง๋ฌธ๋๋ฆฝ๋๋ค.
์๋ ์์ค ์ฒจ๋ถ ๋๋ฆฝ๋๋ค. import { Button, Card } from 'antd'; import Avatar from 'antd/lib/avatar/avatar'; import React, { useCallback } from 'react'; import styled from 'styled-components'; // import PropTypes from 'prop-types'; const UserInfoContainer = styled.div` display: flex; justify-content: space-between; `; const UserProfile = ({ setIsLoggedIn }) => { const onLogOut = useCallback(() => { setIsLoggedIn(false) }, []) return ( ์งน์งน 0, ํ๋ก์0, ํ๋ก์0, ]} > OH} title="OSH" /> ๋ก๊ทธ์์ ); } // UserProfile.propTypes = { // setIsLoggedIn: PropTypes.bool.isRequired, // } export default UserProfile; import React, { useMemo, useState } from 'react'; import Prototype from 'prop-types' import Link from 'next/link' import { Input, Menu, Row, Col } from 'antd' import 'antd/dist/antd.css' import styled, { css } from 'styled-components' import logo from '../img/logo.svg'; import changeLogo from '../img/logo_on.svg'; import UserProfile from '../compontents/UserProfile'; import LoginForm from '../compontents/LoginForm'; const LogoContainter = styled.div` display: flex; `; const UrlLogo = styled.a` width: 32px; height: 32px; display: block; text-indent: -9999px; ${props => props.img && css` background-image: url(${props => props.img}); ` } &:hover{ background-image: url(${changeLogo}); } ` const SearchInput = styled(Input.Search)` vertical-align: middle; `; const LinkWrapper = styled.div` display: flex; flex-direction: column; align-items: center; `; const AppLayout = ({ children }) => { const [isLoggeIn, setIsLoggIn] = useState(false) return ( ๋ ธ๋๋ฒ๋ ํ๋กํ ํ์๊ฐ์ { isLoggeIn ? : } {/* ํ๋กํ */} {children} ( { marginBottom: '10px' } ), [])} href="https://blog.naver.com/qhanfckwsmsd" target="_blank" rel="noreferrer noopener" > Made by OSH Github ); } export default AppLayout; AppLayout.Prototype = { children: Prototype.node.isRequired, }
- 0
- 2
- 189