WEB/Electron

[Electron] npm, electron 설치

S0PH1A 2019. 1. 28. 23:23
반응형

[Electron] npm, electron 설치



Electron 애플리케이션은 근본적으로 Node.js 애플리케이션이라고 할 수 있다.

그래서 Node.js 를 먼저 설치해야한다. 


1. npm 설치

- node.js 를 설치하면 npm 이 자동으로 설치된다.

https://nodejs.org/en/download/ 접속해서 자신의 OS에 맞는 파일 다운.


- 자동으로 저장된 위치 ( mac )

This package has installed:

Node.js v10.15.0 to /usr/local/bin/node

npm v6.4.1 to /usr/local/bin/npm

Make sure that /usr/local/bin is in your $PATH.

- Node.js 버전을 확인.

itinerant-ui-MacBookPro:~ itinerant$ node -v
v10.15.0

- 설치가 완료되면 terminal에서 "npm"을 입력했을 경우 아래와 같이 표시되면 Path가 잘 입력된 것이다.

itinerant-ui-MacBookPro:~ itinerant$ npm

Usage: npm 

where  is one of:
    access, adduser, audit, bin, bugs, c, cache, ci, cit,
    completion, config, create, ddp, dedupe, deprecate,
    dist-tag, docs, doctor, edit, explore, get, help,
    help-search, hook, i, init, install, install-test, it, link,
    list, ln, login, logout, ls, outdated, owner, pack, ping,
    prefix, profile, prune, publish, rb, rebuild, repo, restart,
    root, run, run-script, s, se, search, set, shrinkwrap, star,
    stars, start, stop, t, team, test, token, tst, un,
    uninstall, unpublish, unstar, up, update, v, version, view,
    whoami

npm  -h  quick help on 
npm -l            display full usage info
npm help    search for help on 
npm help npm      involved overview

Specify configs in the ini-formatted file:
    /Users/jiyeon/.npmrc
or on the command line via: npm  --key value
Config info can be viewed via: npm help config

npm@6.4.1 /usr/local/lib/node_modules/npm



2. Electron 설치

- npm을 이용해 Electron 바이너리 버전을 설치

- 앱에서 Electron을 설치할 때는 개발 의존성 모드( --save-dev )로 설치할 것을 권장.

itinerant-ui-MacBookPro:~ itinerant$ npm install electron --save-dev

> electron@4.0.2 postinstall /Users/jiyeon/node_modules/electron
> node install.js

Downloading tmp-825-1-SHASUMS256.txt-4.0.2
[============================================>] 100.0% of 4.74 kB (4.74 kB/s)
npm WARN saveError ENOENT: no such file or directory, open '/Users/jiyeon/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/Users/jiyeon/package.json'
npm WARN jiyeon No description
npm WARN jiyeon No repository field.
npm WARN jiyeon No README data
npm WARN jiyeon No license field.

+ electron@4.0.2
added 145 packages from 137 contributors and audited 201 packages in 130.718s
found 0 vulnerabilities


※ 추가

electron 설치시 아래와 같이 Permission denied가 뜰 때가 있다.


sudo 를 붙여서 명령어를 실행해도 Permission denied가 표시된다.

이럴 경우, "--unsafe-perm" 옵션을 추가하여 명령어를 실행하면 된다.

sudo npm install -g electron --unsafe-perm=true.








참고 : 설치|Electron

반응형