1.操作環境
win10
webstorm2020.1
引入vue前端項目
2.安裝node.js
python-2.7安裝下載
注:node.js需要先安裝Python,必須是python-2.7,python3不行
node-v8.17.0安裝下載
注:我開始安裝最新版的,遇到各種不兼容問題,後來重新選擇
node-v8.17.0終於搭建好了,其它版本也可以試試.
以管理員的方式進入cmd查看配置node.js:
1.查看版本
node -v
2.設置淘寶鏡像庫
1、
npm config set registry https://registry.npm.taobao.org
npm config get registry
2、npm install -g node-gyp
3、npm install –global –production windows-build-tools
4、npm rebuild node-sass
3.webstorm 配置
開始下載依賴
npm cache clean --force
npm install
依賴下載完成,啓動項目
npm run serve
訪問項目
http://localhost:8080/
4.以上方案就是解決安裝過程中踩的坑,僅供參考
Failed to compile.
./src/views/chat/FriendChat.vue?vue&type=style&index=0&id=2f3948a3&lang=scss&scoped=true& (./node_modules/css-loader??ref--8-oneOf-1-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref--8-oneOf-1-2!./node_modules/sass-loader/dist/cjs.js??ref--8-oneOf-1-3!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/views/chat/FriendChat.vue?vue&type=style&index=0&id=2f3948a3&lang=scss&scoped=true&)
Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
Error: Missing binding D:vueproject\node_modules\node-sass\vendor\win32-x64-57\binding.node
Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js 8.x
Found bindings for the following environments:
- Windows 64-bit with Node.js 8.x
This usually happens because your environment has changed since running `npm install`.
Run `npm rebuild node-sass` to download the binding for your current environment.
at module.exports (D:vueproject\node_modules\node-sass\lib\binding.js:15:13)
at Object.<anonymous> (D:vueproject\node_modules\node-sass\lib\index.js:14:35)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at getDefaultSassImplementation (D:vueproject\node_modules\sass-loader\dist\getDefaultSassImplementation.js:24:10)
at getSassImplementation (D:vueproject\node_modules\sass-loader\dist\getSassImplementation.js:19:72)
at Object.loader (D:vueproject\node_modules\sass-loader\dist\index.js:40:61)