Reprint Records: centos7 installs Taobao npm image (cnpm) and vue.js

Keywords: npm Vue Attribute Windows

Original address: https://blog.csdn.net/u013066244/article/details/65629175

This content is only for recording!

Environmental Science

Operating System: Windows 7
Virtual Machine: centos7
vue.js: 2.8

Install nodejs

Refer to another article:
http://blog.csdn.net/u013066244/article/details/63279337

Install cnpm

Because npm is to access the external network, it is very slow, so we can use Taobao mirror.

Baidu Search: Taobao npm Mirror
You can see the official website of Taobao of cnpm.

npm install -g cnpm --registry=https://registry.npm.taobao.org

Verification:

[yutao@yutao-19 ~]$ cnpm -v
cnpm@4.5.0 (/usr/programe_files/node-v6.10.1/lib/node_modules/cnpm/parse_argv.js)
npm@3.10.10 (/usr/programe_files/node-v6.10.1/lib/node_modules/cnpm/node_modules/npm/lib/npm.js)
node@6.10.1 (/usr/programe_files/node-v6.10.1/bin/node)
npminstall@2.26.4 (/usr/programe_files/node-v6.10.1/lib/node_modules/cnpm/node_modules/npminstall/lib/index.js)
prefix=/usr/programe_files/node-v6.10.1 
linux x64 3.10.0-514.el7.x86_64 
registry=https://registry.npm.taobao.org

In my practice, when using cnpm to initialize a vue project, an error will be reported, so it's better to use npm to replace its source.

Replace npm source

npm config set registry https://registry.npm.taobao.org

// After configuration, you can verify success by following ways
npm config get registry
// or
npm info express

http://riny.net/2014/cnpm/

Install vue-cli

We have installed cnpm, so we can use cnpm in the future.

cnpm install -g vue-cli

Parameters:
- g represents global installation. If not, it is the current directory installation.

Verification:

[yutao@yutao-19 ~]$ vue --version
2.8.1

I executed the above command to install OK, but there was an error in the process of installing display.

So after replacing the npm source, I execute again:

# Global Installation vue-cli
$ npm install --global vue-cli

I wanted to uninstall the implementation first, but I didn't find a way to do it online. Think about it, it should be covered again, so I did it.

A small example of the official website.

# Global Installation vue-cli
$ npm install --global vue-cli
# Create a new project based on Web pack template
$ vue init webpack my-project
# Installation Dependency, Go You
$ cd my-project
$ npm install
$ npm run dev

After executing the final startup project, it shows:

[yutao@yutao-19 my-project]$ npm run dev

> my-project@1.0.0 dev /home/yutao/webvueproject/my-project
> node build/dev-server.js

> Starting dev server...



 DONE  Compiled successfully in 12082ms                                                                                             16:32:04

> Listening at http://localhost:8080

(node:3340) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Exited with code 3

Posted by minidak03 on Thu, 07 Feb 2019 23:33:17 -0800