我正在运行npm run dev
和npm run watch
,结果都是退出状态1
[user@server sub]$ npm run watch
> @ watch /home/example/public_html/sub
> npm run development -- --watch
> @ development /home/example/public_html/sub
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js "--watch"
/home/example/public_html/sub/node_modules/terser-webpack-plugin/dist/index.js:375
const optimizeFn = async (compilation, chunks) => {
^
SyntaxError: Unexpected token (
at NativeCompileCache._moduleCompile (/home/example/public_html/sub/node_modules/v8-compile-cache/v8-compile-cache.js:240:18)
at Module._compile (/home/example/public_html/sub/node_modules/v8-compile-cache/v8-compile-cache.js:186:36)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.require (module.js:504:17)
at require (/home/example/public_html/sub/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
at Object.<anonymous> (/home/example/public_html/sub/node_modules/terser-webpack-plugin/dist/cjs.js:3:16)
at Module._compile (/home/example/public_html/sub/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.require (module.js:504:17)
at require (/home/example/public_html/sub/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
at Object.<anonymous> (/home/example/public_html/sub/node_modules/laravel-mix/src/builder/webpack-default.js:1:82)
at Module._compile (/home/example/public_html/sub/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.require (module.js:504:17)
at require (/home/example/public_html/sub/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
at Object.<anonymous> (/home/example/public_html/sub/node_modules/laravel-mix/src/builder/WebpackConfig.js:5:28)
at Module._compile (/home/example/public_html/sub/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.require (module.js:504:17)
at require (/home/example/public_html/sub/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
at Object.<anonymous> (/home/example/public_html/sub/node_modules/laravel-mix/setup/webpack.config.js:27:21)
at Module._compile (/home/example/public_html/sub/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js "--watch"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ development script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/example/.npm/_logs/2020-03-01T23_38_53_281Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ watch: `npm run development -- --watch`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ watch script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/example/.npm/_logs/2020-03-01T23_38_53_300Z-debug.log
我试图清除npm缓存,但由于我有最新的npm版本,我无法清除
[user@server sub]$ npm cache clear
npm ERR! As of npm@5, the npm cache self-heals from corruption issues and data extracted from the cache is guaranteed to be valid. If you want to make sure everything is consistent, use 'npm cache verify' instead. On the other hand, if you're debugging an issue with the installer, you can use `npm install --cache /tmp/empty-cache` to use a temporary cache instead of nuking the actual one.
npm ERR!
npm ERR! If you're sure you want to delete the entire cache, rerun this command with --force.
npm ERR! A complete log of this run can be found in:
对于我的NPM版本
[user@server sub]$ npm -v
6.14.1
对于节点版本
[user@server sub]$ node -v
v6.17.1
我被卡住了,找不到解决方案,请帮忙。
terser-webpack-plugin
需要节点>=8.9。
AFAIKasync()
在8.x.中被添加到节点