Vue CLI4.5.12でsassが使えなく困っています。
1.まず何もインストールしない状態でVueRouterをインストールして生成されたAbout.vueを編集しました。
2.するとエラーが出ます。(当然)
3.言われたとおりsass-loader
をインストールしようと思い試みてもエラでインストールされません。(コンソールで実行)
4.コンソール上からできなかったため、VueCli上からインストールしてみるとエラーメッセージが変わります…
原因は何なのでしょうか?
各種バージョン
npm 7.7.5
Vue/CLI 4.5.12
Vue 3.0.9
vue/compiler-sfc 3.0.9
babel-eslint 10.1.0
eslint 6.8.0
コード
<template> <div class="about"> <h1>This is an about page</h1> </div> </template> <style scoped lang="sass"> div{ color: orange; } </style>
3のエラー
> npm install sass-loader npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! Found: webpack@4.46.0 npm ERR! node_modules/webpack npm ERR! peer webpack@"^4.0.0" from @intervolga/optimize-cssnano-plugin@1.0.6 npm ERR! node_modules/@intervolga/optimize-cssnano-plugin npm ERR! @intervolga/optimize-cssnano-plugin@"^1.0.5" from @vue/cli-service@4.5.12 npm ERR! node_modules/@vue/cli-service npm ERR! peer @vue/cli-service@"^3.0.0 || ^4.0.0-0" from @vue/cli-plugin-babel@4.5.12 npm ERR! node_modules/@vue/cli-plugin-babel npm ERR! dev @vue/cli-plugin-babel@"~4.5.0" from the root project npm ERR! 4 more (@vue/cli-plugin-eslint, @vue/cli-plugin-router, ...) npm ERR! peer webpack@"^4.0.0 || ^5.0.0" from @soda/friendly-errors-webpack-plugin@1.8.0 npm ERR! node_modules/@soda/friendly-errors-webpack-plugin npm ERR! @soda/friendly-errors-webpack-plugin@"^1.7.1" from @vue/cli-service@4.5.12 npm ERR! node_modules/@vue/cli-service npm ERR! peer @vue/cli-service@"^3.0.0 || ^4.0.0-0" from @vue/cli-plugin-babel@4.5.12 npm ERR! node_modules/@vue/cli-plugin-babel npm ERR! dev @vue/cli-plugin-babel@"~4.5.0" from the root project npm ERR! 4 more (@vue/cli-plugin-eslint, @vue/cli-plugin-router, ...) npm ERR! 19 more (@vue/cli-plugin-babel, @vue/cli-plugin-eslint, ...) npm ERR! npm ERR! Could not resolve dependency: npm ERR! sass-loader@"*" from the root project npm ERR! npm ERR! Conflicting peer dependency: webpack@5.28.0 npm ERR! node_modules/webpack npm ERR! peer webpack@"^5.0.0" from sass-loader@11.0.1 npm ERR! node_modules/sass-loader npm ERR! sass-loader@"*" from the root project npm ERR! npm ERR! Fix the upstream dependency conflict, or retry npm ERR! this command with --force, or --legacy-peer-deps npm ERR! to accept an incorrect (and potentially broken) dependency resolution. npm ERR! npm ERR! See C:\Users\ryoum\AppData\Local\npm-cache\eresolve-report.txt for a full report. npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\ryoum\AppData\Local\npm-cache\_logs\2021-03-30T11_43_23_181Z-debug.log
C:\Users\ryoum\AppData\Local\npm-cache\_logs\2021-03-30T11_43_23_181Z-debug.log
の内容は以下です。
log
10 verbose cli [ 20 verbose cli 'C:\Program Files\nodejs\node.exe', 30 verbose cli 'C:\Users\ryoum\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js', 40 verbose cli 'install', 50 verbose cli 'sass-loader' 60 verbose cli ] 71 info using npm@7.7.5 82 info using node@v15.12.0 93 timing npm:load:whichnode Completed in 1ms 104 timing config:load:defaults Completed in 1ms 115 timing config:load:file:C:\Users\ryoum\AppData\Roaming\npm\node_modules\npm\npmrc Completed in 3ms 126 timing config:load:builtin Completed in 3ms 137 timing config:load:cli Completed in 1ms 148 timing config:load:env Completed in 0ms 159 timing config:load:file:C:\Program1\mycontrol.npmrc Completed in 0ms 1610 timing config:load:project Completed in 0ms 1711 timing config:load:file:C:\Users\ryoum.npmrc Completed in 0ms 1812 timing config:load:user Completed in 1ms 1913 timing config:load:file:C:\Users\ryoum\AppData\Roaming\npm\etc\npmrc Completed in 0ms 2014 timing config:load:global Completed in 0ms 2115 timing config:load:validate Completed in 0ms 2216 timing config:load:setEnvs Completed in 1ms 2317 timing config:load Completed in 7ms 2418 timing npm:load:configload Completed in 8ms 2519 timing npm:load:setTitle Completed in 0ms 2620 timing npm:load:setupLog Completed in 0ms 2721 timing npm:load:cleanupLog Completed in 1ms 2822 timing npm:load:configScope Completed in 0ms 2923 timing npm:load:projectScope Completed in 1ms 3024 timing npm:load Completed in 12ms 3125 timing config:load:flatten Completed in 2ms 3226 timing arborist:ctor Completed in 0ms 3327 timing idealTree:init Completed in 469ms 3428 timing idealTree:userRequests Completed in 2ms 3529 silly idealTree buildDeps 3630 silly fetch manifest sass-loader@* 3731 verbose shrinkwrap failed to load node_modules/.package-lock.json out of date, updated: node_modules 3832 http fetch GET 304 https://registry.npmjs.org/sass-loader 541ms (from cache) 3933 silly fetch manifest fibers@>= 3.1.0 4034 http fetch GET 304 https://registry.npmjs.org/fibers 34ms (from cache) 4135 silly fetch manifest node-sass@^4.0.0 || ^5.0.0 4236 http fetch GET 304 https://registry.npmjs.org/node-sass 42ms (from cache) 4337 silly fetch manifest sass@^1.3.0 4438 http fetch GET 304 https://registry.npmjs.org/sass 58ms (from cache) 4539 silly fetch manifest webpack@^5.0.0 4640 http fetch GET 304 https://registry.npmjs.org/webpack 48ms (from cache) 4741 timing idealTree Completed in 1217ms 4842 timing command:install Completed in 1223ms 4943 verbose stack Error: unable to resolve dependency tree 5043 verbose stack at Arborist.[failPeerConflict] (C:\Users\ryoum\AppData\Roaming\npm\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:1157:25) 5143 verbose stack at Arborist.[placeDep] (C:\Users\ryoum\AppData\Roaming\npm\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:1256:32) 5243 verbose stack at C:\Users\ryoum\AppData\Roaming\npm\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:851:46 5343 verbose stack at Array.map (<anonymous>) 5443 verbose stack at Arborist.[buildDepStep] (C:\Users\ryoum\AppData\Roaming\npm\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:851:8) 5543 verbose stack at async Arborist.buildIdealTree (C:\Users\ryoum\AppData\Roaming\npm\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:209:7) 5643 verbose stack at async Promise.all (index 1) 5743 verbose stack at async Arborist.reify (C:\Users\ryoum\AppData\Roaming\npm\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\reify.js:131:5) 5843 verbose stack at async Install.install (C:\Users\ryoum\AppData\Roaming\npm\node_modules\npm\lib\install.js:137:5) 5944 verbose cwd C:\Program1\mycontrol 6045 verbose Windows_NT 10.0.19042 6146 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Users\ryoum\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "install" "sass-loader" 6247 verbose node v15.12.0 6348 verbose npm v7.7.5 6449 error code ERESOLVE 6550 error ERESOLVE unable to resolve dependency tree 6651 error 6752 error Found: [1mwebpack[22m@[1m4.46.0[22m[2m[22m 6852 error [2mnode_modules/webpack[22m 6952 error [35mpeer[39m [1mwebpack[22m@"[1m^4.0.0[22m" from [1m@intervolga/optimize-cssnano-plugin[22m@[1m1.0.6[22m[2m[22m 7052 error [2mnode_modules/@intervolga/optimize-cssnano-plugin[22m 7152 error [1m@intervolga/optimize-cssnano-plugin[22m@"[1m^1.0.5[22m" from [1m@vue/cli-service[22m@[1m4.5.12[22m[2m[22m 7252 error [2mnode_modules/@vue/cli-service[22m 7352 error [35mpeer[39m [1m@vue/cli-service[22m@"[1m^3.0.0 || ^4.0.0-0[22m" from [1m@vue/cli-plugin-babel[22m@[1m4.5.12[22m[2m[22m 7452 error [2mnode_modules/@vue/cli-plugin-babel[22m 7552 error [33mdev[39m [1m@vue/cli-plugin-babel[22m@"[1m~4.5.0[22m" from the root project 7652 error 4 more (@vue/cli-plugin-eslint, @vue/cli-plugin-router, ...) 7752 error [35mpeer[39m [1mwebpack[22m@"[1m^4.0.0 || ^5.0.0[22m" from [1m@soda/friendly-errors-webpack-plugin[22m@[1m1.8.0[22m[2m[22m 7852 error [2mnode_modules/@soda/friendly-errors-webpack-plugin[22m 7952 error [1m@soda/friendly-errors-webpack-plugin[22m@"[1m^1.7.1[22m" from [1m@vue/cli-service[22m@[1m4.5.12[22m[2m[22m 8052 error [2mnode_modules/@vue/cli-service[22m 8152 error [35mpeer[39m [1m@vue/cli-service[22m@"[1m^3.0.0 || ^4.0.0-0[22m" from [1m@vue/cli-plugin-babel[22m@[1m4.5.12[22m[2m[22m 8252 error [2mnode_modules/@vue/cli-plugin-babel[22m 8352 error [33mdev[39m [1m@vue/cli-plugin-babel[22m@"[1m~4.5.0[22m" from the root project 8452 error 4 more (@vue/cli-plugin-eslint, @vue/cli-plugin-router, ...) 8552 error 19 more (@vue/cli-plugin-babel, @vue/cli-plugin-eslint, ...) 8652 error 8752 error Could not resolve dependency: 8852 error [1msass-loader[22m@"[1m*[22m" from the root project 8952 error 9052 error Conflicting peer dependency: [1mwebpack[22m@[1m5.28.0[22m[2m[22m 9152 error [2mnode_modules/webpack[22m 9252 error [35mpeer[39m [1mwebpack[22m@"[1m^5.0.0[22m" from [1msass-loader[22m@[1m11.0.1[22m[2m[22m 9352 error [2mnode_modules/sass-loader[22m 9452 error [1msass-loader[22m@"[1m*[22m" from the root project 9552 error 9652 error Fix the upstream dependency conflict, or retry 9752 error this command with --force, or --legacy-peer-deps 9852 error to accept an incorrect (and potentially broken) dependency resolution. 9952 error 10052 error See C:\Users\ryoum\AppData\Local\npm-cache\eresolve-report.txt for a full report. 10153 verbose exit 1 102
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。