先端開発必須——NPM
1673 ワード
紹介する NPMはnode.jsに基づいて開発されたソフトウェア である. NPMはnode.jsデフォルトパッケージ管理ツールであり、現代のフロントエンド開発には が必要である.
NPMが正常にインストールされているかどうかを確認
NPMミラー NPM現在のミラーを表示する ミラー を設定する.
NPMの更新方法
きほんしよう取付 アンインストール 更新 を表示
package.json詳細(NPMプロファイル)
プロジェクトでNPMインストールパッケージの使用方法
npmがインストールしたパッケージはすべてnode_に保存されています.moudulesフォルダ導入方式 導入経路 接尾辞 を導入
NPMが正常にインストールされているかどうかを確認
npm -v
NPMミラー
NPM
は海外にあるため、ダウンロード速度が遅く不安定なため、国内のミラーに切り替える必要がある(国内で最も有名なミラーはアリの)npm config get registry
npm config set registry https://registry.npm.taobao.org
[ ]
nrmミラー管理ツール//
npm i nrm -g --registry=https://registry.npm.taobao.org
//
nrm ls
//
nrm use taobao
NPMの更新方法
// npm
npm i npm -g
きほんしよう
//
npm i xxx
npm i xxx -S
npm i [email protected] -S
//
npm i xxx -D
:
1、
2、 , package.json
//
npm uninstall xxx -g
//
npm uninstall xxx -D
//
npm uninstall xxx -S
//
npm update -g
//
npm update -g xxx
//
npm update
//
npm update xxx
:
1、 package.json
//
npm ls -g xxx
//
npm ls xxx
//
npm ls
package.json詳細(NPMプロファイル)
プロジェクトでNPMインストールパッケージの使用方法
npmがインストールしたパッケージはすべてnode_に保存されています.moudulesフォルダ
// node.js , CommonJS
const $ = require('jquery');
// webpack , CommonJS ES6
import $ from 'jquery';
const $ = require('jquery');
:webpack ,CommonJS ES6 ,ES6 CommonJS