ng serve --open错误您可能需要适当的加载程序来处理此文件类型

时间:2018-09-08 20:00:23

标签: angular npm

我是angular js的初学者,所以我尝试了Angular quickstart中提到的步骤。当我运行 ng服务-打开时,出现以下错误

(我使用Windows 7)

chunk {main} main.js, main.js.map (main) 11 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 227 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.22 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 15.6 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 3.26 MB [initial] [rendered]

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.
c

我重新安装了npm和角度仍然相同的错误。

节点版本= 10.10.0

npm版本= 6.4.1

角度CLI = 6.2.1

我不明白错误的确切原因以及如何解决它,因此我可以继续本教程的其余部分。

下面是ansi-html文件

#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")

case `uname` in
    *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
esac

if [ -x "$basedir/node" ]; then
  "$basedir/node"  "$basedir/node_modules/ansi-html/bin/ansi-html" "$@"
  ret=$?
else 
  node  "$basedir/node_modules/ansi-html/bin/ansi-html" "$@"
  ret=$?
fi
exit $ret

0 个答案:

没有答案