vue2 webpack打包报错问题
2023-11-30 本文已影响0人
恬雅过客
Q:yarn build命令打包时,报错:
$ node --max_old_space_size=4096 node_modules/.bin/vue-cli-service build --open
D:\workspace\funi-web-all\node_modules\.bin\vue-cli-service:2
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
^^^^^^^
SyntaxError: missing ) after argument list
at wrapSafe (internal/modules/cjs/loader.js:1001:16)
at Module._compile (internal/modules/cjs/loader.js:1049:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
at internal/main/run_main_module.js:17:47
error Command failed with exit code 1.
A:解决:原因因为环境问题,shell命令文件当js文件解析了。将打包命令路径换成js的那个文件路径就可。原本的路径("build": "node --max_old_space_size=4096 node_modules/@vue/cli-service/bin/vue-cli-service build --open",
)改成("build": "node --max_old_space_size=4096 node_modules/@vue/cli-service/bin/vue-cli-service.js build --open",
)。