안녕하세요 상훈입니다.

Vue.js 3,  Tailwind.css 를 설치하여 프로젝트를 npm run serve 를 통해 실행하였는데 에러가 발생하였습니다.

에러 내용

 ERROR  Failed to compile with 1 error                                                                                                                                                                            오후 6:00:02
 error  in ./src/index.css

Syntax Error: Error: Loading PostCSS Plugin failed: Cannot find module 'tailwindcss'
Require stack:
- D:\Projects\loading-view\noop.js

(@D:\Projects\loading-view\postcss.config.js)
    at Array.map (<anonymous>)


 @ ./src/index.css 4:14-157 15:3-20:5 16:22-165
 @ ./src/main.js
 @ multi (webpack)-dev-server/client?http://192.168.219.105:8080&sockPath=/sockjs-node (webpack)/hot/dev-server.js ./src/main.js

 

개략 Tailwindcssmodule을 찾을 수 없다는 문제인데요, 

$ npm install tailwindcss@npm:@tailwindcss/postcss7-compat @tailwindcss/postcss7-compat postcss@^7 autoprefixer@^9

명령어입력(설치)해주신 뒤,

 

module.exports = {
  purge: {  content: ['./public/**/*.html', './src/**/*.vue'] },
  //  ...
}

위의 내용을

 이와 같이 tailwind.config.js 에 작성해주고 저장해주세요.

 

그리고 다시 프로젝트 구동 "npm run serve" 해주시면 정상적으로 실행이 됩니다.

 

이상입니다.

 

 

참고

 

Syntax Error: Error: Loading PostCSS Plugin failed: Cannot find module 'tailwindcss' · Issue #32 · forsartis/vue-cli-plugin-ta

ERROR Failed to compile with 1 error 20:44:08 error in ./src/assets/tailwind.css Syntax Error: Error: Loading PostCSS Plugin failed: Cannot find module 'tailwindcss' Every couple of weeks I...

github.com

 

 

 

반응형

안녕하세요 상훈입니다.

JavascriptPromise에 대해 알아보겠습니다.

내용은 해당 영상을 참고하였습니다.

 

Promiseasync 까지 연결되어 사용하는 내용도 가능합니다.

하지만 이번에는 성공, then() 까지만 확인하도록 하겠습니다.

 

예시) 일반적인 함수 사용하기.

기본적으로 delay라는 함수가 있을 때, 인자로 seccallback을 받습니다. 

함수 내부에는 setTimeout을 이용하여 sec초 뒤에 callback을 출력하는 함수입니다. (시간을 띄울거예요!)

function delay(sec, callback) {
    setTimeout(() => {
        callback (new Date().toISOString())
    }, sec * 1000)
}
delay(1, (result) => {
    console.log(1, result)
})

 

그리고 delay함수를 1초 뒤result 함수로 출력하겠다! 선언하면, 1초 뒤에 

해당 내용 출력

해당 내용이 출력됩니다.

 

만약 이곳에서 여러 개delay함수를 사용하여 쓰고싶다!  이렇다면, 흔히 말하는 콜백지옥함수가 될겁니다.

delay(1, (result) => {
    console.log(1, result)

    delay(1, (result) => {
        console.log(2, result)

        delay(1, (result) => {
            console.log(3, result)

            delay(1, (result) => {
                console.log(4, result)

                delay(1, (result) => {
                    console.log(5, result)
                })
            })
        })
    })
})

결과

결과적으로 잘~ 작동합니다! 하지만, 만약 저 코드 양이 방대해진다면, 본인은 물론 다른 사람도 보다가 미쳐서 모니터를 주먹으로 칠 수도 있습니다.

그래서 나온것이 Promise() 입니다.


 

예시2) Promise() : 여러 개의 then() 사용하기

function delayP(sec) {	// 인자를 시간초만 받음
    return new Promise( ( resolve, reject ) => {    // Promise (성공, 실패) 선언
        setTimeout(() => {
            resolve (new Date().toISOString())  // resolve(성공)에 해당하는 항목
        }, sec * 1000)
    })
}

 

then()

delayP(1)
    .then((result)=> {  
        console.log(1, result)
        return delayP(1)    // delayP() 를 return 시켜 새로운 promise를 실행하는 것. then으로 이어 받을 수 있다.
    })
    .then((result) => { // 2번 째 then을 통해서 위의 첫번째 then이 실행된 이후에 실행. 즉, 1초 + 1초 에 실행된다.
        console.log(2, result)
    })

 Promise() .then() 을 사용하는 것의 장점은 더 말할 필요가 없이 보기가 쉽습니다. 

또한 구분지어서 코드를 작성하는데에도 문제가 없죠. 

출력 결과

 

 

하지만 만약 반환값(return)을 작성해주지 않는다면,

delayP(1)
    .then((result)=> {  
        console.log(1, result)
        return delayP(1)    // delayP() 를 return 시켜 새로운 promise를 실행하는 것. then으로 이어 받을 수 있다.
    })
    .then((result) => { // 2번 째 then을 통해서 위의 첫번째 then이 실행된 이후에 실행. 즉, 1초 + 1초 에 실행된다.
        console.log(2, result)
        // return이 없다. => 다음 result = undefined가 될 것이다.
        // return 'string or something' 하면 해당하는 내용이 바로 출력된다. 
            // => delay를 통해 해당 내용을 지연시키지 않았기 때문에.
    })
    .then((result) => { // 받은 return 값이 null 이기 때문에 undefined를 출력한다.
        console.log(3, result)  // 출력 내용 ( 3, undefined )
    })

2번째 then에서 return없습니다!

=> 3번째 delayP( null ) 이 들어갔다는 뜻입니다.

그렇기 때문에 출력되는 것은 ( 3, undefined ) 가 됩니다.

출력 결과

추가적으로 sec 라는 인자도 전달이 안되었기 때문
바로 세번째 then() 이 실행되어 3, result 가 출력되었습니다.

2, 3번째 then()을 보기쉽게 해보자면, 아래와 같습니다.

    .then((result) => {
        console.log(2, result)
        console.log(3, result)  
    })

물론 2번째 then true라는 전제조건이 존재하지만요.

 

이상으로 promise 기초에 대한 포스팅을 마치겠습니다.

감사합니다.

 

 

참고

https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/Promise

 

Promise - JavaScript | MDN

Promise 객체는 비동기 작업이 맞이할 미래의 완료 또는 실패와 그 결과 값을 나타냅니다.

developer.mozilla.org

 

 

 

반응형

안녕하세요 상훈입니다.

Vue cli 3 를 유튜브로 클론코딩 하였습니다.

해당 강의 링크 및 영상

위는 해당하는 강의 내용입니다.

 

Vue.js 버전은 3.2.20 이고, 
Vue/cli4.~ 입니다. 

Vue.js version description

 

styletailwind.css를 사용하였고,
추가된 라이브러리는 moment.js 로, datetime을 출력할 수 있는 자바스크립트 라이브러리입니다. 

tailwind
구현내용 header

일단 결과적으로 문제가 한 개 있었는데 고치지 못하였습니다. ㅎㅎ;;

moment.js 관련해서 인 것같은데 어떻게 해야할지 모르겠더군요. 

=> 원작 개발자님의 소스를 보아도 아예 포맷이 달라, 결론을 얻어내지 못하였습니다.

좌 : 내 프로젝트  /  우 : 원작 프로젝트(수정된듯)
해당하는 에러

발생한 에러는 dataDate(현재시각)관련해서의 에러인데... 타입에러가 발생하였고, 프로퍼티가 선언되지 않았다고 합니다.

분명 main vue 에서
1. 변수 선언
2. DataTitle.vue 에서 props로 참조해주어
3. data 출력을 진행하였지만 해당되는 내용에 에러가 발생하였습니다. 

언젠가 이게 무슨 원리로 제대로 작동하는지 이해해서 수정할 수 있을거라 생각합니다......ㅎ.ㅎ..


결과화면

국가를 선택하기 전 : Global 설정.
현재

select-option을 이용하여 해당 내역을 모두 불러올 수 있고, 이를 computed 처리하여 실시간으로 데이터가 전환됩니다. 

button - Clear Country 하면 다시 Global을 나타냅니다. (=초기화)

 

모바일 화면에서는 이렇게 출력될겁니다.

 

 


이렇게 프로젝트를 따라 만들어보면서 느낀것이 

1. vue.js 에 대해 이제 알아듣는 것 보니 걸음마는 떼었다.
2. async await에 대해 공부를 좀 해야겠습니다.

이상입니다.

수고!

 

사용

 

Icon Loading GIF - Find & Share on GIPHY

Discover & share this Icon GIF with everyone you know. GIPHY is how you search, share, discover, and create GIFs.

giphy.com

코로나 api

 

Coronavirus COVID19 API

The Postman Documenter generates and maintains beautiful, live documentation for your collections. Never worry about maintaining API documentation again.

documenter.getpostman.com

 

Moment.js | Docs

moment.relativeTimeThreshold(unit); // getter moment.relativeTimeThreshold(unit, limit); // setter duration.humanize has thresholds which define when a unit is considered a minute, an hour and so on. For example, by default more than 45 seconds is consider

momentjs.com

 

Vue에서 moment사용하기 (feat. vue-moment)

자바스크립트에서 거의 표준으로 사용되고 있는 날짜관련 라이브러리인 Moment 를 Vue에서 쉽게 사용할 수 있는 라이브러리가 있습니다. vue-moment 는 Vue에서 필터 형식으로 Moment를 사용할 수 있게

ux.stories.pe.kr

 

async와 await를 사용하여 비동기 프로그래밍을 쉽게 만들기 - Web 개발 학습하기 | MDN

Javascript에 대한 최신 추가 사항은 ECMAScript 2017 JavaScript 에디션의 일부인 async functions 그리고 await 키워드는 ECMAScript2017에 추가되었습니다. 이 기능들은 기본적으로 비동기 코드를 쓰고 Promise를

developer.mozilla.org

프로젝트전체

 

GitHub - bradtraversy/vue-covid-tracker: Simple tracker for Covid-19 cases and deaths

Simple tracker for Covid-19 cases and deaths. Contribute to bradtraversy/vue-covid-tracker development by creating an account on GitHub.

github.com

,

반응형

sudo service apache2 start / restart 에러

systemctl status apache2.service
● apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Wed 2021-10-27 14:16:45 KST; 16min ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 475439 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)

10월 27 14:16:45 server systemd[1]: Starting The Apache HTTP Server...
10월 27 14:16:45 server apachectl[475447]: apache2: Syntax error on line 231 of /etc/apache2/apache2.conf: Could not open configuration file /etc/phpmyadmin/apache.conf: No such file or directory
10월 27 14:16:45 server apachectl[475439]: Action 'start' failed.
10월 27 14:16:45 server apachectl[475439]: The Apache error log may have more information.
10월 27 14:16:45 server systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAILURE
10월 27 14:16:45 server systemd[1]: apache2.service: Failed with result 'exit-code'.
10월 27 14:16:45 server systemd[1]: Failed to start The Apache HTTP Server.

환경: Linux Ubuntu 20.0.4LTS, PHP8, Apache 사용

사전 작업 : php7.4 -> php 8.0으로 업그레이드 (완료)

 

이에 해당하는 에러를 어떤 사람이 /etc/apache2/apache2.conf  파일의 수정을 통해 해결했다는 내용이 있었다.

 

이에 맞춰 apache2.conf 를 자세히 보던 와중 에러 문구가 눈에 띄었다.

phpmyadmin 부분에서 문제라는 것을 확인하였다. 

 

그래서 과감하게 (사실은 소심하게 주석까지 해주면서ㅋㅋ)  phpmyadmin을 사용하지 않으니 해당 부분을 주석처리하여 서버(server)를 구동할 때 해당 부분을 읽지 않게 하였더니 성공.

=> 하지만 이것은 phpmyadmin을 사용하시는 분들은 하면 안된다는 것을 확인해주세요.

 

아무래도 php 버전 업그레이드(7.4->8.0 upgrade)를 하면서
phpmyadmin 고유의 데이터베이스(database)를 놓고,

해당 부분을 추가적으로 손보지 않았기 때문에 이러한 에러가 발생한 것 같았다.

 

그리고 이제 다시 restart를 해보니 성공.

 

 

이상입니다.

 

apache2 error Could not open configuration file /etc/apache2/conf.d/: No such file or directory

I have just upgraded my Ubuntu 13.10 and apache2 is not working. When I try to start the apache2 server it is printing following errors: * Starting web server apache2 * The apache2 configtest fa...

askubuntu.com

 

How can I start apache2 from error code=exited status=1 | DigitalOcean

Im a web developer and im new in Ubuntu, I have days trying to install apache2 to work with php. But I always get this error starting Apache2: ``` Job for apache2.service failed because the control process exited with error code. See 'systemctl status

www.digitalocean.com

 

apache restart 오류 질문입니다

우분투 서버이구요 index죽이기 하려고 했는데 mod_write 가 설치 안되어있는 것같아 구글링해서 설치하던 중  service apache2 restart를 했는데 아래와 같이 나옵니다..   Job for apache2.service f

www.cikorea.net

 

How to Upgrade from PHP 7.x to PHP 8 on Ubuntu (Apache) - DevAnswers.co

How-to guide on upgrading PHP 7.x to PHP 8 on Ubuntu (Apache). Remove PHP 7.x and Install PHP 8 on Ubuntu (Apache)

devanswers.co

 

반응형
Error:  You are using an unsupported version of Node. Please update to at least Node v12.14
    at assertSupportedNodeVersion

Error:  You are using an unsupported version of Node. Please update to at least Node v12.14 at assertSupportedNodeVersion

그래서 업데이트를 진행하였는데 추가적인 에러가발생하여 node 자체를 지우고 재설치를 하게되었다.

 

 

1. node.js 제거 과정 (디렉터리와 bash 내용을 전부 삭제)

sudo rm -rf /usr/local/bin/npm /usr/local/share/man/man1/node* /usr/local/lib/dtrace/node.d ~/.npm ~/.node-gyp /opt/local/bin/node /opt/local/include/node /opt/local/lib/node_modules 

sudo rm -rf /usr/local/lib/node* ; sudo rm -rf /usr/local/include/node* ; sudo rm -rf /usr/local/bin/node*

sudo apt-get purge nodejs npm

 

2. node.js 설치과정

sudo apt install nodejs

sudo apt install npm

// cache 제거. 안해주시면 에러 발생가능성이 있습니다.
sudo npm cache clean -f 

// 전역에서 사용가능하게 npm을 n이라는 이름으로 다운로드
sudo npm install -g n

// 안정화 버전을 설치
sudo n stable

 

3. 확인

node -v
v16.13.0

npm -v
8.1.0

 

 

자꾸 오류 나고 그래서 삭제만 8번 넘게 진행한 것 같네요.

억울하고 분통터져

원래 뭘 진행하려고 했는지도 머리속에서 증발하게 되었습니다. ㅎㅎ 
다시 무엇을 하려고했는지 떠나요~

 

 

참고

 

[Node] Node.js, NPM 최신버전으로 업그레이드하기

기존 node.js 가 설치 되어 있다고 가정하에 업그레이드를 진행합니다. Node.js Upgrade 1. 현재 Node.js 버전확인 $ node -v 2. cache 삭제 $ sudo npm cache clean -f 3. n 모듈 설치 $ sudo npm install -g n 4..

eomtttttt-develop.tistory.com

 

npm Error: Cannot find module 'semver'

I get the following error when I try to run npm command root@localhost:# npm --version internal/modules/cjs/loader.js:584 throw err; ^ Error: Cannot find module 'semver'...

superuser.com

 

 

Ubuntu – Npm can’t find module “semver” error in Ubuntu 19.04 – iTecTec

I am getting the following error whenever I try to run npm command. internal/modules/cjs/loader.js:626 throw err; ^ Error: Cannot find module 'semver' Require stack: - /usr/share/npm/lib/utils/unsupported.js - /usr/share/npm/bin/npm-cli.js at Function.Modu

itectec.com

기타 등등..

반응형
반응형
반응형

안녕하세요 상훈입니다.

Window10 기준으로 설명드리도록 하겠습니다. (아마 웬만한 같은 윈도우라면 해당사항이 될겁니다.)

윈도우 부팅 시, 프로그램 혹은 웹 익스플로러 등이 실행될 수 있게 설정을 하도록 하겠습니다.

예를 들어, 티스토리 메인페이지의 바로가기 프로그램이 있습니다.

이 파일을 부팅 시 바로 실행하도록 하겠습니다.

1. window + R 
2. shell:startup 작성+엔터
3. 해당 폴더에 아이콘 복사

1. window + R

shell:stratup을 작성해주세요 그리고 enter!

 

혹은, 아래의 사용자명을 본인의 계정명으로 바꾸신 뒤 폴더에서 복사 붙여넣기 해주세요.

C:\Users\사용자명(바꿔주세요)\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

 

카카오톡, 하이웍스 = 시작프로그램

여기 있는 모든 아이템들이 시작 프로그램입니다. 

자, 이제 이곳에 처음의 Tistory 실행프로그램을 옮기도록 하겠습니다.

(간단하게 드래그&드롭 아시죠?) (ctrl+c, v도 좋습니다.)

 

이상입니다.

 

 

참고

 

윈도우10 컴퓨터 부팅시 프로그램 자동실행 설정 방법

윈도우10 컴퓨터 부팅시 프로그램 #자동실행 설정 방법 입니다. 많은분들이 윈도우7 지원 종료로 윈도우10...

blog.naver.com

 

 

반응형

+ Recent posts