安装启动web端项目
安装cnpm
npm install -g cnpm --registry=https://registry.npm.taobao.org
或者设置下载仓库为淘宝镜像
npm config set registry http://registry.npm.taobao.org/
eg:
C:\Users\x1c>npm config set registry http://registry.npm.taobao.org/
C:\Users\x1c>npm config list
; cli configs
metrics-registry = "http://registry.npm.taobao.org/"
scope = ""
user-agent = "npm/6.5.0 node/v11.9.0 win32 x64"
; userconfig C:\Users\x1c\.npmrc
cache = "D:\\Environments\\nodejs\\node_cache"
disturl = "https://npm.taobao.org/dist"
prefix = "D:\\Environments\\nodejs\\node_global"
python = "C:\\Users\\x1c\\.windows-build-tools\\python27\\python.exe"
registry = "http://registry.npm.taobao.org/"
; node bin location = D:\Environments\nodejs\node.exe
; cwd = C:\Users\x1c
; HOME = C:\Users\x1c
; "npm config ls -l" to show all defaults.
C:\Users\x1c>
安装完出现以下错误 Module build failed: Error: Cannot find module ‘node-sass’
Module build failed: Error: Cannot find module 'node-sass'
错误表示找不到模块node-sass
我的node、npm版本
C:\Users\x1c>node -v
v11.9.0
C:\Users\x1c>npm -v
6.5.0
C:\Users\x1c>
错误信息是表示找不到node-sass模块,我重新安装下吧。
解决办法执行
cnpm install node-sass
若安装过程中出现Permission denied错误,则用如下命令安装:
npm install node-sass --unsafe-perm=true --allow-root
或者直接npm
npm install node-sass
我的安装好了
cnpm install node-sass
√ Installed 1 packages
√ Linked 0 latest versions
√ Run 0 scripts
√ All packages installed (used 237ms(network 229ms), speed 50.5kB/s, json 1(11.56kB), tarball 0B)
重新 cnpm install 整个项目再运行整个项目吧,可以了
cnpm install
npm run dev
F:\project\gmall\mall-admin-web>cnpm install
√ Installed 49 packages
√ Linked 0 latest versions
√ Run 0 scripts
√ All packages installed (used 48ms(network 40ms), speed 0B/s, json 0(0B), tarball 0B)
F:\project\gmall\mall-admin-web>npm run dev
> mall-admin-web@1.0.0 dev F:\project\gmall\mall-admin-web
> webpack-dev-server --inline --progress --config build/webpack.dev.conf.js
13% building modules 27/31 modules 4 active ...dules\_vue@2.6.11@vue\dist\vue.esm.js
....
DONE Compiled successfully in 27146ms 00:55:26
I Your application is running here: http://localhost:8090