**Install**
[[[webpack官方网站-installed](https://webpack.js.org/guides/installation)]
[TOC]
## Local Installation
Before we begin, make sure you have a fresh version of [Node.js](https://nodejs.org/en/) installed. The current Long Term Support (LTS) release is an ideal starting point.
To install the latest release or a specific version, run one of the following commands:
~~~bash
npm install --save-dev webpack
npm install --save-dev webpack@<version>
~~~
If you're using webpack v4 or later, you'll also need to install the[CLI](https://webpack.js.org/api/cli/).
~~~bash
npm install --save-dev webpack-cli
~~~
Installing locally is what we recommend for most projects. This makes it easier to upgrade projects individually when breaking changes are introduced. Typically webpack is run via one or more [npm scripts](https://docs.npmjs.com/misc/scripts) which will look for a webpack installation in your local `node_modules` directory:
~~~json
"scripts": {
"build": "webpack --config webpack.config.js"
}
~~~
>[info] To run the local installation of webpack you can access its binary version as `node_modules/.bin/webpack`.
> Alternatively, if you are using npm v5.2.0 or greater, you can run 'npx webpack' to do it.
First let's create a directory `webpack-demo`, initialize npm, install webpack locally, and install the webpack-cli (the tool used to run webpack on the command line):
~~~bash
mkdir webpack-demo
cd webpack-demo
npm init -y
npm install webpack --save-dev
npm install webpack-cli --save-dev
~~~
>[info] When installing a package that will be bundled into your production bundle, you should use `npm install --save`, `package.json->"dependencies"`.
> If you're installing a package for development purposes (e.g. a linter, testing libraries, etc.) then you should use `npm install --save-dev`, `package.json->"devDependencies"`
## Global Installation
The following NPM installation will make `webpack` available globally:
~~~bash
npm install --global webpack
~~~
>[warning] Note that this is **not a recommended practice**. Installing globally locks you down to a specific version of webpack and could fail in projects that use a different version.
- WebAPP
- Linux Command
- 入门
- 处理文件
- 查找文件单词
- 环境
- 联网
- Linux
- Linux目录配置标准:FHS
- Linux文件与目录管理
- Linux账号管理与ACL权限设置
- Linux系统资源查看
- 软件包管理
- Bash
- Daemon/Systemd
- ftp
- Apache
- MySQL
- Command
- Replication
- mysqld
- remote access
- remark
- 限制
- PHP
- String
- Array
- Function
- Class
- File
- JAVA
- Protocals
- http
- mqtt
- IDE
- phpDesigner
- eclipse
- vscode
- Notepad++
- WebAPI
- Javasript
- DOM
- BOM
- Event
- Class
- Module
- Ajax
- Fetch
- Promise
- async/await
- Statements and declarations
- Function
- Framwork
- jQurey
- Types
- Promise
- BootStrap
- v4
- ThinkPHP5
- install
- 定时任务
- CodeIgniter
- React.js
- node.js
- npm
- npm-commands
- npm-folder
- package.json
- Docker and private modules
- module
- webpack.js
- install
- configuration
- package.json
- entry
- modules
- plugins
- Code Splitting
- loaders
- libs
- API
- webpack-cli
- Vue.js
- install
- Compile
- VueAPI
- vuex
- vue-router
- vue-devtools
- vue-cli
- vue-loader
- VDOM
- vue-instance
- components
- template
- Single-File Components
- props
- data
- methods
- computed
- watch
- Event-handling
- Render Func
- remark
- 案例学习
- bootstrap-vue
- modal
- fontAwesome
- Hosting Font Awesome Yourself
- using with jquery
- using with Vue.js
- HTML
- CSS
- plugins
- Chart.js
- D3.js
- phpSpreadSheet
- Guzzle
- Cmder
- Git
- git命令
- git流程
- Postman
- Markdown
- Regular Expressions
- PowerDesigner
- 附录1-学习资源