我使用以下方法创建了新的角度项目:
ng new my-app3
为my-app创建文件夹结构并初始化node_modules文件夹。
一旦安装了所有node_modules,它将二进制文件从所有节点模块复制到my-app2目录:
D:\Work\playgrounds\angular\my-app3\parser -> D:\Work\playgrounds\angular\my-app2\node_modules\@babel\parser\bin\babel-parser.js
D:\Work\playgrounds\angular\my-app3\acorn -> D:\Work\playgrounds\angular\my-app2\node_modules\acorn\bin\acorn
D:\Work\playgrounds\angular\my-app3\ansi-html -> D:\Work\playgrounds\angular\my-app2\node_modules\ansi-html\bin\ansi-html
D:\Work\playgrounds\angular\my-app3\atob -> D:\Work\playgrounds\angular\my-app2\node_modules\atob\bin\atob.js
D:\Work\playgrounds\angular\my-app3\babylon -> D:\Work\playgrounds\angular\my-app2\node_modules\babylon\bin\babylon.js
.... Serveral other files same as above ....
现在,如果我尝试使用“ ng serve”,它将失败,并显示以下消息:
ERROR in ./ansi-html 1:0
Module parse failed: Unexpected character '#' (1:0)
You may need an appropriate loader to handle this file type.
> #!/bin/sh
| basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
i 「wdm」: Failed to compile.
我的Angular版本是:
PS D:\Work\playgrounds\angular\my-app3> ng version
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 7.3.5
Node: 8.12.0
OS: win32 x64
Angular: 7.2.8
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.13.5
@angular-devkit/build-angular 0.13.5
@angular-devkit/build-optimizer 0.13.5
@angular-devkit/build-webpack 0.13.5
@angular-devkit/core 7.3.5
@angular-devkit/schematics 7.3.5
@angular/cli 7.3.5
@ngtools/webpack 7.3.5
@schematics/angular 7.3.5
@schematics/update 0.13.5
rxjs 6.3.3
typescript 3.2.4
webpack 4.29.0
一旦我从my-app3文件夹中删除了ansi-html和ansi-html.cmd文件,它就会编译并可以正常工作。
有人可以建议为什么将所有node_module文件都复制到my-app3文件夹中吗?