Laravel: npm Код выхода 1, код ELIFECYCLE на CentOS - PullRequest
0 голосов
/ 02 марта 2020

У меня запущены 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

Я застрял, не смог найти решение, любую помощь, пожалуйста .

1 Ответ

3 голосов
/ 02 марта 2020

terser-webpack-plugin требует узла> = 8,9.

AFAIK async() был добавлен к узлу в 8.x.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...