版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/yujing1314/article/details/89474344
用SVN检出项目之后,直接运行ionic serve 结果出现以下错误
ERROR in ./src/global.scss (./node_modules/@angular-devkit/build-angular/src/angular-cli-files/plugins/raw-css-loader.js!./node_modules/postcss-loader/src??embedded!./node_modules/[email protected]@sass-loader/lib/loader.js??ref--14-3!./src/global.scss)
[ng] Module build failed (from ./node_modules/[email protected]@sass-loader/lib/loader.js):
[ng] Error: Missing binding E:\项目\orderSystem_net\trunk\OrderSystem_V2.0-phone\ionicphone\node_modules\node-sass\vendor\win32-x64-67\binding.node
[ng] Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js 11.x
[ng] Found bindings for the following environments:
[ng] - Windows 64-bit with Node.js 10.x
[ng] This usually happens because your environment has changed since running `npm install`.
[ng] Run `npm rebuild node-sass` to download the binding for your current environment.
[ng] at module.exports (E:\项目\orderSystem_net\trunk\OrderSystem_V2.0-phone\ionicphone\node_modules\node-sass\lib\binding.js:15:13)
[ng] at Object.<anonymous> (E:\项目\orderSystem_net\trunk\OrderSystem_V2.0-phone\ionicphone\node_modules\node-sass\lib\index.js:14:35)
[ng] at Module._compile (internal/modules/cjs/loader.js:816:30)
[ng] at Object.Module._extensions..js (internal/modules/cjs/loader.js:827:10)
[ng] at Module.load (internal/modules/cjs/loader.js:685:32)
[ng] at Function.Module._load (internal/modules/cjs/loader.js:620:12)
[ng] at Module.require (internal/modules/cjs/loader.js:723:19)
[ng] at require (internal/modules/cjs/helpers.js:14:16)
[ng] at Object.sassLoader (E:\项目\orderSystem_net\trunk\OrderSystem_V2.0-phone\ionicphone\node_modules\[email protected]@sass-loader\lib\loader.js:46:72)
[ng] ERROR in ./src/theme/variables.scss (./node_modules/@angular-devkit/build-angular/src/angular-cli-files/plugins/raw-css-loader.js!./node_modules/postcss-loader/src??embedded!./node_modules/[email protected]@sass-loader/lib/loader.js??ref--14-3!./src/theme/variables.scss)
[ng] Module build failed (from ./node_modules/[email protected]@sass-loader/lib/loader.js):
[ng] Error: Missing binding E:\项目\orderSystem_net\trunk\OrderSystem_V2.0-phone\ionicphone\node_modules\node-sass\vendor\win32-x64-67\binding.node
[ng] Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js 11.x
[ng] Found bindings for the following environments:
[ng] - Windows 64-bit with Node.js 10.x
[ng] This usually happens because your environment has changed since running `npm install`.
[ng] Run `npm rebuild node-sass` to download the binding for your current environment.
[ng] at module.exports (E:\项目\orderSystem_net\trunk\OrderSystem_V2.0-phone\ionicphone\node_modules\node-sass\lib\binding.js:15:13)
[ng] at Object.<anonymous> (E:\项目\orderSystem_net\trunk\OrderSystem_V2.0-phone\ionicphone\node_modules\node-sass\lib\index.js:14:35)
[ng] at Module._compile (internal/modules/cjs/loader.js:816:30)
[ng] at Object.Module._extensions..js (internal/modules/cjs/loader.js:827:10)
[ng] at Module.load (internal/modules/cjs/loader.js:685:32)
[ng] at Function.Module._load (internal/modules/cjs/loader.js:620:12)
[ng] at Module.require (internal/modules/cjs/loader.js:723:19)
[ng] at require (internal/modules/cjs/helpers.js:14:16)
[ng] at Object.sassLoader (E:\项目\orderSystem_net\trunk\OrderSystem_V2.0-phone\ionicphone\node_modules\[email protected]@sass-loader\lib\loader.js:46:72)
[ng] ERROR in ./src/app/tab1/tab1.page.scss
[ng] Module build failed (from ./node_modules/[email protected]@sass-loader/lib/loader.js):
[ng] Error: Missing binding E:\项目\orderSystem_net\trunk\OrderSystem_V2.0-phone\ionicphone\node_modules\node-sass\vendor\win32-x64-67\binding.node
[ng] Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js 11.x
[ng] Found bindings for the following environments:
[ng] - Windows 64-bit with Node.js 10.x
[ng] This usually happens because your environment has changed since running `npm install`.
[ng] Run `npm rebuild node-sass` to download the binding for your current environment.
[ng] at module.exports (E:\项目\orderSystem_net\trunk\OrderSystem_V2.0-phone\ionicphone\node_modules\node-sass\lib\binding.js:15:13)
[ng] at Object.<anonymous> (E:\项目\orderSystem_net\trunk\OrderSystem_V2.0-phone\ionicphone\node_modules\node-sass\lib\index.js:14:35)
[ng] at Module._compile (internal/modules/cjs/loader.js:816:30)
[ng] at Object.Module._extensions..js (internal/modules/cjs/loader.js:827:10)
[ng] at Module.load (internal/modules/cjs/loader.js:685:32)
[ng] at Function.Module._load (internal/modules/cjs/loader.js:620:12)
[ng] at Module.require (internal/modules/cjs/loader.js:723:19)
[ng] at require (internal/modules/cjs/helpers.js:14:16)
[ng] at Object.sassLoader (E:\项目\orderSystem_net\trunk\OrderSystem_V2.0-phone\ionicphone\node_modules\[email protected]@sass-loader\lib\loader.js:46:72)
解决方案
主要是windows平台缺少编译环境,
1、先运行:
npm install -g node-gyp
2、然后运行:运行
npm install --global --production windows-build-tools //可以自动安装跨平台的编译器:
3.先卸载之前的sass,然后再下一步
npm uninstall node-sass
4.重新安装
npm install node-sass
大功告成