Error 저장소

  1. FRONTEND
    1. HTML
    2. CSS
    3. PUG
      1. Failed to lookup
    4. Vanila JS
      1. code: ‘ERR_MODULE_NOT_FOUND’
        1. global Router import Error
        2. ReferenceError: [함수] is not defined
        3. node:internal/modules/cjs/loader
      2. code: ‘ERR_DLOPEN_FAILED’
    5. React
      1. JavaScript
      2. TypeScript
        1. import Router from “react-router-dom” 오류
        2. ERROR : Type ‘string | undefined’ is not assignable to type ‘string’.
        3. is not valid JSON
        4. root 에러
        5. Module Not Found (./App)
        6. Emitted ‘error’ event on WatchmanWatcher instance at:
    6. SQL
      1. MySQL
        1. code: ‘ER_NOT_SUPPORTED_AUTH_MODE’
    7. Git
      1. CRLF
      2. error: src refspec master does not match any
    8. BACKEND
      1. JAVA
      2. JSP
    9. Deploy
      1. Netlify
        1. “build.command” failed
      2. Docker
      3. failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0
      4. CSP(Content Security Policy)
  2. Jekyll (GIHUB BLOG)

FRONTEND

HTML


CSS


PUG

Failed to lookup

Error: Failed to lookup view “home” in views

=> 현재 package.json에서 node.js를 실행하고 있기에 여기가 cwd가 되는 것이다.

해결법 예시.

app.set("view engine", "pug");
app.set("views", process.cwd() + "/src/views");

=> 위의 코드로 cwd를 설정하여 프로젝트의 views의 경로를 알려주고 문제를 해결할 수 있다.


Vanila JS


code: ‘ERR_MODULE_NOT_FOUND’

global Router import Error

해결 방법.
아래와 같이 변경
import globalRouter from "./routers/globalRouter";
–> import globalRouter from "./routers/globalRouter.js";


ReferenceError: [함수] is not defined

함수명 오타, 함수의 부재 그리고 함수가 연결되지 않았을 때 발생


node:internal/modules/cjs/loader

방법 1. 파일 존재하는 지 확인하기
방법 2. node_modules & package-lock.json 삭제 후 npm install


code: ‘ERR_DLOPEN_FAILED’

  • WSL 사용 중 OS 차이로 생겨나는 오류
  • bcrypt 문제로 생겨나는 오류

해결 방법.
node_modules 삭제 후 Windows OS에서 npm install입력


React

JavaScript

TypeScript

import Router from “react-router-dom” 오류

직접 작성한 Router.tsx에서 Router를 가져와야 했으나 react-router-dom에서 Router를 가져와 오류가 생겼다.

ERROR : Type ‘string | undefined’ is not assignable to type ‘string’.

react-query V6 ```js

<Route path=”chart” element={<Chart coinId={coinId!} />} />

>> key값 뒤에 '!' 붙여주기
<hr>

## BACKEND
#### Node JS
##### 오류 1.Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client

#### Express
##### Uncaught SyntaxError: Unexpected token '<'
빌드할 떄 JS가 아닌 HTML 구문으로 인식하여 나오는 에러.<br>

>> `package.json`<br> "homepage":"." 으로 변경하여 해결하였다.
<hr>

#### API

##### set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
- CORS (Cross-Origin Resource Sharing Policy) 위반 문제


>> 해결 방법
package.json
```js
"proxy": "<베이스 주소>"

위와 같이 추가해준다.

is not valid JSON

해결 방법 브라우저 캐시 삭제 후 프로젝트 재실행


root 에러

해결 방법.

const root = ReactDOM.createRoot(document.getElementById("root");
const root = ReactDOM.createRoot(document.getElementById("root") as HTMLElement);

Module Not Found (./App)

해결 방법: npx tsc --init 명령어로 tsconfig.json 파일 생성
아래 코드 추가 ```js { “compilerOptions”: {

“jsx”: “react-jsx” } }


<hr>

### React Native
#### Expo
##### There was a problem loading the requested app.
문제: expo 실행 시 모바일 기기와 연결 불가

>> 해결 방법: 컴퓨터와 연결하고자 하는 기기가 같은 공유기를 사용하는지 확인하기
<hr>

##### unable to resolve "node_modules/expo/AppEntry.js"
문제: expo 실행 시 app에서 오류 발생<br>

>> 해결 방법: node_modules 삭제 후 재설치
```js
rm -rf node_modules
npm install

Emitted ‘error’ event on WatchmanWatcher instance at:

문제: watchman 오류

SQL

MySQL

code: ‘ER_NOT_SUPPORTED_AUTH_MODE’

NodeJS에서 MySQL 접속 시 발생하는 사용자 권한 오류.

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY <<Password>>;

Git

CRLF

유닉스에서는 한 줄의 끝이 LF(Line Feed),
윈도우에서는 한 줄이 CR(Carriage Return)과 LF로 이루어져 있기 때문에
어느 것을 선택해야할 지 묻는 경고이다.

해결 방법.
해당 프로젝트만 설정: git config core.autocrlf true
전역 프로젝트 설정: git config –global core.autocrlf true


error: src refspec master does not match any

해결 방법.
push 할 떄 branch가 master인지 main인지 확인할 것.


BACKEND

JAVA

JSP

Deploy

Netlify

“build.command” failed

Docker

failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0

CSP(Content Security Policy)

express 기준 npm install helmet-csp

Jekyll (GIHUB BLOG)

### Liquid Warning: Liquid syntax error jekyll에서 사용되는 Liquid syntax는 “와 “를 escape 문자로 사용한다. 주로 CSS를 구문을 적을 때 에러 메세지를 출력한다.

-> 문제의 코드를 로 감싸서 escape 문자가 아님을 알려준다.