webpack编译时在新电脑上出现ts-loader错误。

问题描述 投票:0回答:1

我刚刚安装了一台新的笔记本电脑,检查了我的源代码,按照常规运行npm安装。然后运行webpack构建,如下

npm run clean && npm run scss && webpack --bail --progress --profile。

然后我就得到了这个错误,我在任何地方都找不到它的细节。我已经放弃了node_modules,并重新运行npm安装,但仍然得到同样的问题。我已经束手无策了......有什么办法可以解决这个问题吗?

ERROR in ./src/main/webapp/admin/main.ts
Module build failed (from ./node_modules/ts-loader/index.js):
\node_modules\ts-loader\node_modules\micromatch\index.js:44
    let isMatch = picomatch(String(patterns[i]), { ...options, onResult }, true);
                                                   ^^^
SyntaxError: Unexpected token ...
    at NativeCompileCache._moduleCompile (E:\mydirs\node_modules\v8-compile-cache\v8-compile-cache.js:240:18)
    at Module._compile (E:\mydirs\node_modules\v8-compile-cache\v8-compile-cache.js:186:36)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)`

我使用typecript 2.7.2,node 6.11.0和npm 3.10.10。

typescript npm webpack npm-install npm-start
1个回答
0
投票

我升级到node 10,删除了node_modules,再次运行npm安装,现在一切正常。

© www.soinside.com 2019 - 2024. All rights reserved.