尝试在Prestashop:中编译主题(命名为foo(
cd themes/foo/_dev
npm run build
获取以下错误。
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! prestashop-classic-dev-tools@1.0.0 build: `webpack`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the prestashop-classic-dev-tools@1.0.0 build 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! /root/.npm/_logs/2021-07-02T05_58_35_445Z-debug.log
这是日志
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 'build' ]
2 info using npm@6.14.13
3 info using node@v14.17.0
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle prestashop-classic-dev-tools@1.0.0~prebuild: prestashop-classic-dev-tools@1.0.0
6 info lifecycle prestashop-classic-dev-tools@1.0.0~build: prestashop-classic-dev-tools@1.0.0
7 verbose lifecycle prestashop-classic-dev-tools@1.0.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle prestashop-classic-dev-tools@1.0.0~build: PATH: /usr/lib/node_modules/npm/node_mod$
9 verbose lifecycle prestashop-classic-dev-tools@1.0.0~build: CWD: /var/www/html/themes/foo$
10 silly lifecycle prestashop-classic-dev-tools@1.0.0~build: Args: [ '-c', 'webpack' ]
11 silly lifecycle prestashop-classic-dev-tools@1.0.0~build: Returned: code: 2 signal: null
12 info lifecycle prestashop-classic-dev-tools@1.0.0~build: Failed to exec build script
13 verbose stack Error: prestashop-classic-dev-tools@1.0.0 build: `webpack`
13 verbose stack Exit status 2
13 verbose stack at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle$
13 verbose stack at EventEmitter.emit (events.js:376:20)
13 verbose stack at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle$
13 verbose stack at ChildProcess.emit (events.js:376:20)
13 verbose stack at maybeClose (internal/child_process.js:1055:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
14 verbose pkgid prestashop-classic-dev-tools@1.0.0
15 verbose cwd /var/www/html/themes/foo/_dev
16 verbose Linux 5.8.0-59-generic
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "run" "build"
18 verbose node v14.17.0
19 verbose npm v6.14.13
20 error code ELIFECYCLE
21 error errno 2
22 error prestashop-classic-dev-tools@1.0.0 build: `webpack`
22 error Exit status 2
23 error Failed at the prestashop-classic-dev-tools@1.0.0 build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 2, true ]
npm版本为:
> npm -v
6.14.13
原因可能是什么?
未找到问题的原因。使用以下命令解决:
清理npm缓存
> npm cache clean --force
删除节点模块
> rm -rf node_modules package-lock.json
安装npm
> npm install
运行构建
> npm run build