2

我尝试使用php artisan ui tailwindcss --auth命令安装 Tailwind UI Auth。CSS Scaffolding 和 CSS auth Scaffolding 都安装成功,我运行命令npm install && npm run dev编译新的脚手架。NPM 安装发生,但在命令的开发过程中,应用程序未正确编译。错误日志如下;

> 0 verbose cli [
0 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
0 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
0 verbose cli   'install'
0 verbose cli ]
1 info using npm@7.11.2
2 info using node@v16.1.0
3 timing npm:load:whichnode Completed in 2ms
4 timing config:load:defaults Completed in 2ms
5 timing config:load:file:C:\Program Files\nodejs\node_modules\npm\npmrc Completed in 4ms
6 timing config:load:builtin Completed in 4ms
7 timing config:load:cli Completed in 2ms
8 timing config:load:env Completed in 1ms
9 timing config:load:file:E:\Google Drive\laravel_training\secondproject\.npmrc Completed in 0ms
10 timing config:load:project Completed in 2ms
11 timing config:load:file:C:\Users\Charles-MS\.npmrc Completed in 0ms
12 timing config:load:user Completed in 0ms
13 timing config:load:file:C:\Users\Charles-MS\AppData\Roaming\npm\etc\npmrc Completed in 0ms
14 timing config:load:global Completed in 0ms
15 timing config:load:validate Completed in 0ms
16 timing config:load:credentials Completed in 1ms
17 timing config:load:setEnvs Completed in 2ms
18 timing config:load Completed in 14ms
19 timing npm:load:configload Completed in 14ms
20 timing npm:load:setTitle Completed in 0ms
21 timing npm:load:setupLog Completed in 1ms
22 timing npm:load:cleanupLog Completed in 3ms
23 timing npm:load:configScope Completed in 0ms
24 timing npm:load:projectScope Completed in 1ms
25 timing npm:load Completed in 22ms
26 timing config:load:flatten Completed in 4ms
27 timing arborist:ctor Completed in 4ms
28 timing idealTree:init Completed in 1291ms
29 timing idealTree:userRequests Completed in 0ms
30 silly idealTree buildDeps
31 silly fetch manifest @tailwindcss/ui@^0.3
32 http fetch GET 304 https://registry.npmjs.org/@tailwindcss%2fui 3735ms (from cache)
33 silly fetch manifest tailwindcss@^2.1.2
34 http fetch GET 200 https://registry.npmjs.org/tailwindcss 708ms
35 silly fetch manifest tailwindcss@^1.3.3
36 silly fetch manifest autoprefixer@^9.6
37 http fetch GET 304 https://registry.npmjs.org/autoprefixer 256ms (from cache)
38 silly fetch manifest autoprefixer@^10.0.2
39 timing idealTree Completed in 6018ms
40 timing command:install Completed in 6032ms
41 verbose stack Error: unable to resolve dependency tree
41 verbose stack     at Arborist.[failPeerConflict] (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:1221:25)
41 verbose stack     at Arborist.[loadPeerSet] (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:1188:34)
41 verbose stack     at async Arborist.[loadPeerSet] (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:1175:23)
41 verbose stack     at async Arborist.[buildDepStep] (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:892:11)
41 verbose stack     at async Arborist.buildIdealTree (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:218:7)
41 verbose stack     at async Promise.all (index 1)
41 verbose stack     at async Arborist.reify (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\reify.js:135:5)
41 verbose stack     at async Install.install (C:\Program Files\nodejs\node_modules\npm\lib\install.js:137:5)
42 verbose cwd E:\Google Drive\laravel_training\secondproject
43 verbose Windows_NT 10.0.19042
44 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
45 verbose node v16.1.0
46 verbose npm  v7.11.2
47 error code ERESOLVE
48 error ERESOLVE unable to resolve dependency tree
49 error
50 error While resolving: [1mundefined[22m@[1mundefined[22m
50 error Found: [1mautoprefixer[22m@[1m9.8.6[22m[2m[22m
50 error [2mnode_modules/autoprefixer[22m
50 error   [33mdev[39m [1mautoprefixer[22m@"[1m^9.6[22m" from the root project
50 error
50 error Could not resolve dependency:
50 error [35mpeer[39m [1mautoprefixer[22m@"[1m^10.0.2[22m" from [1mtailwindcss[22m@[1m2.1.2[22m[2m[22m
50 error [2mnode_modules/tailwindcss[22m
50 error   [1mtailwindcss[22m@"[1m^2.1.2[22m" from the root project
50 error
50 error Fix the upstream dependency conflict, or retry
50 error this command with --force, or --legacy-peer-deps
50 error to accept an incorrect (and potentially broken) dependency resolution.
50 error
50 error See C:\Users\Charles-MS\AppData\Local\npm-cache\eresolve-report.txt for a full report.
51 verbose exit 1

如何克服这个错误?即使我将节点更新到最新版本(v16.1.0)但无法修复错误......

4

1 回答 1

1

以下解决方案对我有用;

运行将npm audit fix --forcelaravel-mix 更新到 6.0.19 的命令,这是 SemVer 的重大更改。然后运行npm run dev将成功编译 webpack。此错误是由于过时的 laravel-mix 包引起的。

于 2021-05-08T03:39:23.227 回答