반응형

Visual Studio Code에 React 설치중 다음과 같은 오류가 발생했다.

npm ERR! code ENOENT
npm ERR! syscall lstat
npm ERR! path C:\Users\w10\AppData\Roaming\npm
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, lstat 'C:\Users\w10\AppData\Roaming\npm'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

 

그래서 ChatGPT에게 물어보았다.

이 오류는 npm이 특정 파일 또는 디렉토리를 찾을 수 없을 때 발생합니다. 
오류 메시지에서 ENOENT는 "No such file or directory"의 약자로, 해당 파일 또는 디렉토리가 존재하지 않는다는 것을 나타냅니다.
이 문제를 해결하기 위해 다음 단계를 따르실 수 있습니다.

1. 캐시 및 임시 파일 정리: 먼저 npm의 캐시 및 임시 파일을 정리하고 
문제가 해결되지 않았을 경우에만 다음 단계로 진행하세요. 
명령 프롬프트 또는 터미널에서 다음 명령을 실행합니다.

npm cache clean -f

2. npm 업데이트: npm을 최신 버전으로 업데이트하면 일부 문제가 해결될 수 있습니다. 
다음 명령을 실행하여 npm을 업데이트합니다.

npm install -g npm

등등

나는 2번의 방법으로 해결이 되었다!

반응형
반응형

1. 오류

- 깃으로 pull을 하려고 했지만 'error: Your local changes to the following files would be overwritten by merge:' 과 같은 에러가 나왔다.

 

2. 원인

- 소스코드를 변경하고 push를 안해줬다던가 해서 변경사항이 있기때문에 pull이 안되고 저런 오류가 나온다.

 

3. 해결방법

- $ git status를 해보면

- 역시나 빨갛게 변경되어있다고 나온다.

- git checkout .

  - 사용해서 최신 상태로 돌려준다.

  - 이것을 사용하면 기존에 커밋된 것 이후로 수정된것은 다시 커밋된 상태로 소스코드가 돌아간다.

- 다시 git pull origin master하면 해결 끝!

반응형
반응형

1. 발생

- 프로그래머스 문제를 푸는 와중에 이런 오류가 발견되었다.

 

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
at Solution.solution(Unknown Source)
at SolutionTest.lambda$main$0(Unknown Source)
at SolutionTest$SolutionRunner.run(Unknown Source)
at SolutionTest.main(Unknown Source)

 

2. 코드

class Solution {
	public long[] solution(long x, int n) {
		long[] answer = {};

		for (int i = 0; i < n; i++) {

			answer[i] = x * (i + 1);
		}

		return answer;
	}
}

 

3. 해결

- 구글링을 해보니 인덱스가 배열의 크기보다 크거나 음수가 나온다면 예외를 발생시킨다.

- 에러코드를 자세히 살펴보니 0의 크기라고 그러길래 코드를 자세히 살펴보니 배열도 제대로 선언을 하지않고,

  배열을 사용했다...

class Solution {
	public long[] solution(int x, int n) {
		long[] answer = new long[n];

		for (int i = 0; i < n; i++) {

			answer[i] = x * (i + 1);
		}

		return answer;
	}
}

- 그래서 이렇게 수정을 해주었다.

- 어이없는 실수....ㅠㅠㅠ

반응형
반응형

1. 해결과정

git commit을 하고 git push origin master를 하였는데

$ git push origin master
error: src refspec mater does not match any
error: failed to push some refs to 'https://github.com/~~~~~'

이렇게 에러발생

 

그리고 git status를 하였으나

$ git status
fatal: unable to read tree ~~~~~~~~~~~~~~

이런 에러 메시지 또 발생.....

 

그래서 구글링을 들어갔다.

 

검색어는 'error: src refspec main does not match any error: failed to push some refs to'

 

게시글중에 master 브랜치가 없어져서 생기는 문제라는 글을 보고

git add .
git commit -m "~~~~~~~~"
git push origin master

했더니 정상으로 이전에 올라가지 않았던 것까지 업로드가 되었다.

 

2. 참고한 링크

https://stratosphere.tistory.com/90

반응형

+ Recent posts