角形材质中的自定义主题无法建立

时间:2020-08-05 01:15:14

标签: node.js angular

我在为应用程序构建的角度材质中有一个自定义主题。 scss文件如下。

microfocus-theme.scss

@import '~@angular/material/theming';

@include mat-core();

$microfocus-primary: mat-palette($mat-blue);
$microfocus-accent:  mat-palette($mat-blue, A200, A100, A400);


$microfocus-theme: mat-light-theme($microfocus-primary, $microfocus-accent);

@include angular-material-theme($microfocus-theme);

我修改了angular.json以包含此文件

  "architect": {
    "build": {
      "builder": "@angular-devkit/build-angular:browser",
      "options": {
        "outputPath": "dist/agentform",
        "index": "src/index.html",
        "main": "src/main.ts",
        "polyfills": "src/polyfills.ts",
        "tsConfig": "src/tsconfig.app.json",
        "assets": [
          "src/favicon.ico",
          "src/assets"
        ],
        "styles": [
          "src/microfocus-theme.scss",
          "./node_modules/bootstrap/dist/css/bootstrap.min.css",
          "src/styles.css"
        ],
        "scripts": [],
        "es5BrowserSupport": true

当我去提供该应用程序时。我收到以下错误

D:\Code\docker\docker-idol-jeff\web\agentform>ng serve
Your global Angular CLI version (10.0.5) is greater than your local
version (7.3.10). The local Angular CLI version is used.

To disable this warning use "ng config -g cli.warnings.versionMismatch false".
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **

Date: 2020-08-05T01:04:54.807Z
Hash: 913c9c2466ed84d66be2
Time: 11566ms
chunk {es2015-polyfills} es2015-polyfills.js, es2015-polyfills.js.map (es2015-polyfills) 285 kB [initial] [rendered]
chunk {main} main.js, main.js.map (main) 69.5 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 236 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.08 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 1.17 MB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 7.08 MB [initial] [rendered]

ERROR in ./src/microfocus-theme.scss (./node_modules/@angular-devkit/build-angular/src/angular-cli-files/plugins/raw-css-loader.js!./node_modules/postcss-loader/src??embedded!./node_modules/sass-loader/lib/loader.js??ref--14-3!./src/microfocus-theme.scss)
Module build failed (from ./node_modules/sass-loader/lib/loader.js):
Error: Missing binding D:\Code\docker\docker-idol-jeff\web\agentform\node_modules\node-sass\vendor\win32-x64-72\binding.node
Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js 12.x

Found bindings for the following environments:
  - Windows 64-bit with Node.js 10.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:\Code\docker\docker-idol-jeff\web\agentform\node_modules\node-sass\lib\binding.js:15:13)
    at Object.<anonymous> (D:\Code\docker\docker-idol-jeff\web\agentform\node_modules\node-sass\lib\index.js:14:35)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14)
    at Module.require (internal/modules/cjs/loader.js:1025:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.sassLoader (D:\Code\docker\docker-idol-jeff\web\agentform\node_modules\sass-loader\lib\loader.js:46:72)
i 「wdm」: Failed to compile.

我的应用程序正在D驱动器中运行,我已经在C中安装了npm。我希望这不会引起问题。

我确实跑过npm rebuild node-sass --force

然后我收到以下错误集

D:\Code\docker\docker-idol-jeff\web\agentform>npm rebuild node-sass --force
npm WARN using --force I sure hope you know what you are doing.

> node-sass@4.13.1 install D:\Code\docker\docker-idol-jeff\web\agentform\node_modules\node-sass
> node scripts/install.js

Downloading binary from https://github.com/sass/node-sass/releases/download/v4.13.1/win32-x64-72_binding.node
Download complete  ] - :
Binary saved to D:\Code\docker\docker-idol-jeff\web\agentform\node_modules\node-sass\vendor\win32-x64-72\binding.node
Caching binary to C:\Users\josevina\AppData\Roaming\npm-cache\node-sass\4.13.1\win32-x64-72_binding.node

> node-sass@4.13.1 postinstall D:\Code\docker\docker-idol-jeff\web\agentform\node_modules\node-sass
> node scripts/build.js

Building: C:\Program Files\nodejs\node.exe D:\Code\docker\docker-idol-jeff\web\agentform\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [
gyp verb cli   'C:\\Program Files\\nodejs\\node.exe',
gyp verb cli   'D:\\Code\\docker\\docker-idol-jeff\\web\\agentform\\node_modules\\node-gyp\\bin\\node-gyp.js',
gyp verb cli   'rebuild',
gyp verb cli   '--verbose',
gyp verb cli   '--libsass_ext=',
gyp verb cli   '--libsass_cflags=',
gyp verb cli   '--libsass_ldflags=',
gyp verb cli   '--libsass_library='
gyp verb cli ]
gyp info using node-gyp@3.8.0
gyp info using node@12.18.3 | win32 | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` failed Error: not found: python2
gyp verb `which` failed     at getNotFoundError (D:\Code\docker\docker-idol-jeff\web\agentform\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (D:\Code\docker\docker-idol-jeff\web\agentform\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (D:\Code\docker\docker-idol-jeff\web\agentform\node_modules\which\which.js:80:29)
gyp verb `which` failed     at D:\Code\docker\docker-idol-jeff\web\agentform\node_modules\which\which.js:89:16
gyp verb `which` failed     at D:\Code\docker\docker-idol-jeff\web\agentform\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at D:\Code\docker\docker-idol-jeff\web\agentform\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqCallback.oncomplete (fs.js:168:21)
gyp verb `which` failed  python2 Error: not found: python2
gyp verb `which` failed     at getNotFoundError (D:\Code\docker\docker-idol-jeff\web\agentform\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (D:\Code\docker\docker-idol-jeff\web\agentform\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (D:\Code\docker\docker-idol-jeff\web\agentform\node_modules\which\which.js:80:29)
gyp verb `which` failed     at D:\Code\docker\docker-idol-jeff\web\agentform\node_modules\which\which.js:89:16
gyp verb `which` failed     at D:\Code\docker\docker-idol-jeff\web\agentform\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at D:\Code\docker\docker-idol-jeff\web\agentform\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqCallback.oncomplete (fs.js:168:21) {
gyp verb `which` failed   code: 'ENOENT'
gyp verb `which` failed }
gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` succeeded python C:\Program Files (x86)\Python38-32\python.EXE
gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:\Program Files (x86)\Python38-32\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack   File "<string>", line 1
gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack                       ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:303:12)
gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
gyp ERR! stack     at maybeClose (internal/child_process.js:1021:16)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
gyp ERR! System Windows_NT 10.0.17763
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "D:\\Code\\docker\\docker-idol-jeff\\web\\agentform\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd D:\Code\docker\docker-idol-jeff\web\agentform\node_modules\node-sass
gyp ERR! node -v v12.18.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1
node-sass@4.13.1 D:\Code\docker\docker-idol-jeff\web\agentform\node_modules\node-sass

1 个答案:

答案 0 :(得分:0)

Administrator打开终端并运行以下命令:

npm install --global --production windows-build-tools
相关问题