1

我正在尝试构建一个 Laravel Nova 工具,但是当我尝试安装该工具的依赖项时,出现错误。经过一段时间的尝试解决后,它导致 webpack 需要多个版本来处理不同的依赖项,但我似乎无法让它们一起工作。在我的项目文件夹中,当我运行时npm audit fix,出现此错误:

npm WARN webpack-cli@3.1.2 requires a peer of webpack@^4.x.x but none is installed. You must install peer dependencies yourself.

up to date in 6.37s
fixed 0 of 1 vulnerability in 15833 scanned packages
1 vulnerability required manual review and could not be updated

我可以通过将 webpack 版本更改为最新版本来解决此问题,但随后npm run watch无法正常工作,并且 Laravel Nova 工具资产仍然无法正确编译。

这是我在尝试创建 nova 工具时遇到的错误:

npm WARN deprecated browserslist@2.11.3: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated gulp-util@3.0.8: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
....
 The `/mnt/c/Users/me/projects/project/nova-components/Anothertool/node_modules/pngquant-bin/vendor/pngquant` binary doesn't seem to work correctly
 ⚠ pngquant pre-build test failed
 ℹ compiling from source
 ✔ pngquant pre-build test passed successfully
 ✖ Error: pngquant failed to build, make sure that libpng-dev is installed
at Promise.all.then.arr (/mnt/c/Users/me/projects/project/nova-components/Anothertool/node_modules/pngquant-bin/node_modules/bin-build/node_modules/execa/index.js:231:11)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
npm WARN ajv-keywords@3.2.0 requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! pngquant-bin@4.0.0 postinstall: `node lib/install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the pngquant-bin@4.0.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

这个问题已经困扰我好几天了,无论我做什么或改变,我都无法解决这个问题。安装不同版本的软件包时,我不断收到不同的错误。我能做些什么来解决这个问题?

4

1 回答 1

-2

您是否尝试过像这样重新运行它:

// within your project root directory
rm -rf node_modules package-lock.json yarn.lock
npm cache clear --force
npm install

分别运行每一行。

于 2018-11-16T23:43:53.153 回答