[Node.js] package.json and Linux Commands

Alpaca·2021년 3월 18일
0

Node.js

목록 보기
1/3

설정을 다 끝내고 terminal에서 npm init을 입력하니

This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.

See `npm help init` for definitive documentation on these fields
and exactly what they do.

Use `npm install <pkg>` afterwards to install a package and
save it as a dependency in the package.json file.

Press ^C at any time to quit.

해당 문구가 출력됐다
간단하게 말하면 package.json파일이 없어서 자동으로 생성할건데 가장 기본적인 값들만 설정해 주겠다는 말이다
그냥 엔터키 쭉 누르면 package.json파일이 생성될 것이다

그 후 나는 express.js를 설치하고 싶어서 terminal

npm i express --save 

을 입력해 설치했다

추가적으로 몇가지 명령어를 살펴보자면 touch는 파일을 생성하고
mv(move)는 말그대로 파일을 이동시킨다(이름변경도 가능하다)

# create 'index.js`
touch index.js

# rename 'index.js` to 'new_name.js'
mv index.js new_name.js

# create directory
mkdir something

# create 'else.js'
touch something/else.js

# rename 'else.js` to 'whatever.js'
mv something/else.js to something/whatever.js

# move `index.js' file in to the 'something' directory
mv index.js something

# remove directory
rm something
// rm: cannot remove 'something': is a directory

# remove directory with something else in it
rm -rf something

rm(remove)에서 option인 -rf(remove a folder)를 통해 폴더를 삭제할 수 있다

profile
2020년 10월 15일 퇴사하고 개발자의 길에 도전합니다.

0개의 댓글