我一直试图提供一个Angular网页,但是它不会编译说它找不到node-sass模块,并且在搜索了堆栈溢出之后,我发现我应该尝试重建模块,但是当我这样做,我得到一个Python语法错误,如下所示。我有Python版本3.8.3,但我尝试重新安装节点和有角度的CLI,但无济于事。您对我该如何解决这个问题有任何想法吗?
bash> npm rebuild node-sass
[...]
gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:\Users\rmsegec\AppData\Local\Programs\Python\Python38\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
[...]
这是我设置的Angular版本:
Angular CLI: 10.0.1
Node: 10.16.3
OS: win32 x64
Angular: 7.2.16
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: <error>
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.13.10
@angular-devkit/build-angular 0.13.10
@angular-devkit/build-optimizer 0.13.10
@angular-devkit/build-webpack 0.13.10
@angular-devkit/core 7.3.10
@angular-devkit/schematics 10.0.1
@angular/cdk 7.3.7
@angular/cli 10.0.1
@angular/material 7.3.7
@ngtools/webpack 7.3.10
@nguniversal/express-engine 8.2.6
@schematics/angular 10.0.1
@schematics/update 0.1000.1
rxjs 6.4.0
typescript 3.2.4
webpack 4.29.0
答案 0 :(得分:0)
我不确定是什么原因导致了我遇到的问题,但是我已经设法解决了。我必须将npm配置为使用python 2,安装Visual Studio 2017工具并手动安装角度包@angular-devkit/build-angular
,即使package.json
中已引用它也是如此。
PS:奇怪的是,这些相同的项目在我刚刚安装了Visual Studio 2019的朋友计算机上就可以工作。