How to use npm to download vue.js: First go to the [node.js] official website to download and install the tool; then install bower; then initialize npm; finally pass "npm install vue -- save" to download vue.
Recommended: "vue tutorial"
The operating environment of this tutorial: windows7 system, Vue2.9.6 version, this method is applicable to all brands of computers.
Use npm to download vue:
npm(Node Package Manager): Package manager under node.js
Go to the node.js official website to download and install the tool. After nodejs is installed, npm will be automatically installed. Enter the following command on the command line to test whether it is installed. If successful, the version number will appear correctly.
node -v npm -v
Look at the other two directories: npm and npm-cache under C:\Users\Administrator\AppData\Roaming. The local warehouse of npm runs in the user directory of the system disk c drive (not seen) to npm-cache because it has not been used and the cache directory is generated as soon as it is used), we tried to move these two directories back to D:\nodejs
First create 2 new folders in the nodejs directory: node_cache and node_global
Then run the following 2 commands
npm config set prefix "D:\nodejs\node_global" npm config set cache "D:\nodejs\node_cache"
Look at npm’s local warehouse, enter the following commands and find that the directory has changed :
npm list -global
Enter the following command to configure the Taobao mirror station:
npm config set registry=http://registry.npm.taobao.org
Enter the following command to display all configuration information:
npm config list
We pay attention to a configuration file C:\Users\Administrator\.npmrc and find that the information just configured is in this file.
Update npm:
npm install npm -g
Check what modules are in global again:
npm list -global
Add D:\nodejs\node_global to the environment variable PATH.
Install bower first: (To install bower, you need to install node.js and git first)
npm insall bower -g
After installation, corresponding commands will be added in the node_global directory.
Check the vue version:
bower info vue
Initialize npm and guide the creation of a package.json file in the project to save the installation package information:
npm init --yes
Enter the project root directory, cnpm install vue --save or -S (cnpm is Taobao npm, if npm changes the download source The address is Taobao source, you can use npm directly instead of cnpm)
npm install vue --save
The above is the detailed content of How to use npm to download vue.js. For more information, please follow other related articles on the PHP Chinese website!