Closed8

なぜか node を 16.15.1 以上に上げられない問題に挑む Scrap

sogaohsogaoh
package.json
package.json

{
    "private": true,
    "scripts": {
        "dev": "npm run development",
        "development": "mix",
        "watch": "mix watch",
        "watch-poll": "mix watch -- --watch-options-poll=1000",
        "hot": "mix watch --hot",
        "prod": "npm run production",
        "production": "mix --production",
        "lint": "eslint --ext .js,.vue resources"
    },
    "devDependencies": {
        "@tailwindcss/forms": "^0.2.1",
        "alpinejs": "^2.7.3",
        "autoprefixer": "^10.1.0",
        "axios": "^0.21",
        "babel-eslint": "^10.1.0",
        "bootstrap": "^4.6.0",
        "eslint": "^7.24.0",
        "eslint-config-prettier": "^8.2.0",
        "eslint-plugin-prettier": "^3.4.0",
        "eslint-plugin-vue": "^7.9.0",
        "jquery": "^3.6",
        "laravel-mix": "^6.0.43",
        "laravel-mix-polyfill": "^3.0.0",
        "lodash": "^4.17.21",
        "popper.js": "^1.12",
        "postcss": "^8.2.1",
        "postcss-import": "^12.0.1",
        "prettier": "^2.2.1",
        "resolve-url-loader": "^3.1.2",
        "sass": "^1.32.8",
        "sass-loader": "^11.0.1",
        "tailwindcss": "^2.0.2",
        "tailwindcss-plugins": "^0.3.0",
        "vue": "^2.6.12",
        "vue-eslint-parser": "^7.6.0",
        "vue-loader": "^15.9.8",
        "vue-template-compiler": "^2.6.12"
    },
    "dependencies": {
        "bootstrap-icons": "^1.4.1",
        "js-cookie": "^3.0.1",
        "vue-flatpickr-component": "^8.1.6",
        "vue-js-modal": "^2.0.0-rc.6"
    }
}
sogaohsogaoh
tailwind.config.js
tailwind.config.js

const defaultTheme = require("tailwindcss/defaultTheme");

module.exports = {
    purge: [
        "./vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php",
        "./storage/framework/views/*.php",
        "./resources/views/**/*.blade.php",
        "./resources/js/page/App.vue",
        "./resources/js/components/admin/**/*.vue",
    ],

    theme: {
        extend: {
            fontFamily: {
                sans: ["sans-serif"],
            },
        },
    },

    variants: {
        extend: {
            opacity: ["disabled"],
        },
    },

    plugins: [
        require("tailwindcss-plugins/pagination"),
        require("@tailwindcss/forms"),
    ],
};
sogaohsogaoh
.npm/eresolve-report.txt
2022-10-27T09:43:54.493Z

While resolving: tailwindcss-plugins@0.3.0
Found: tailwindcss@2.1.4
node_modules/tailwindcss
  dev tailwindcss@"^2.0.2" from the root project

Could not resolve dependency:
peer tailwindcss@"^1.0" from tailwindcss-plugins@0.3.0
node_modules/tailwindcss-plugins
  dev tailwindcss-plugins@"^0.3.0" from the root project

Conflicting peer dependency: tailwindcss@1.9.6
node_modules/tailwindcss
  peer tailwindcss@"^1.0" from tailwindcss-plugins@0.3.0
  node_modules/tailwindcss-plugins
    dev tailwindcss-plugins@"^0.3.0" from the root project

Fix the upstream dependency conflict, or retry
this command with --force, or --legacy-peer-deps
to accept an incorrect (and potentially broken) dependency resolution.

Raw JSON explanation object:

{
  "code": "ERESOLVE",
    "type": "peer",
    "name": "tailwindcss",
    "spec": "^1.0",
    "error": "INVALID",
    "from": {
      "name": "tailwindcss-plugins",
      "version": "0.3.0",
      "location": "node_modules/tailwindcss-plugins",
      "isWorkspace": false,
      "dependents": [
        {
          "type": "dev",
          "name": "tailwindcss-plugins",
          "spec": "^0.3.0",
          "from": {
            "location": "/home/sogaoh3/ghq/github.com/***"
          }
        }
      ]
    }
  },
  "dep": {
    "name": "tailwindcss",
    "version": "1.9.6",
    "whileInstalling": {
      "name": "tailwindcss-plugins",
      "version": "0.3.0",
    },
    "location": "node_modules/tailwindcss",
    "isWorkspace": false,
    "dependents": [
      {
        "type": "peer",
        "name": "tailwindcss",
        "spec": "^1.0",
        "error": "INVALID",
        "from": {
          "name": "tailwindcss-plugins",
          "version": "0.3.0",
          "location": "node_modules/tailwindcss-plugins",
          "isWorkspace": false,
          "dependents": [
            {
              "type": "dev",
              "name": "tailwindcss-plugins",
              "spec": "^0.3.0",
              "from": {
                "location": "/home/sogaoh3/ghq/github.com/***"
              }
            }
          ]
        }
      }
    ]
  "current": {
    "name": "tailwindcss",
    "version": "2.1.4",
    "location": "node_modules/tailwindcss",
    "isWorkspace": false,
    "dependents": [
      {
        "type": "dev",
        "name": "tailwindcss",
        "spec": "^2.0.2",
        "from": {
          "location": "/home/sogaoh3/ghq/github.com/***"
        }
      }
    ]
  },
  "peerConflict": {
    "current": {
      "name": "tailwindcss",
      "version": "2.1.4",
      "location": "node_modules/tailwindcss",
      "isWorkspace": false,
      "dependents": [
        {
          "type": "dev",
          "name": "tailwindcss",
          "spec": "^2.0.2",
          "from": {
            "location": "/home/sogaoh3/ghq/github.com/***"
          }
        }
      ]
    },
    "peer": {
      "name": "tailwindcss",
      "version": "1.9.6",
      "whileInstalling": {
        "name": "tailwindcss-plugins",
        "version": "0.3.0",
        "path": "/home/sogaoh3/ghq/github.com/***/node_modules/tailwindcss-plugins"
      },
      "location": "node_modules/tailwindcss",
      "isWorkspace": false,
      "dependents": [
        {
          "type": "peer",
          "name": "tailwindcss",
          "spec": "^1.0",
          "error": "INVALID",
          "from": {
            "name": "tailwindcss-plugins",
            "version": "0.3.0",
            "location": "node_modules/tailwindcss-plugins",
            "isWorkspace": false,
            "dependents": [
              {
                "type": "dev",
                "name": "tailwindcss-plugins",
                "spec": "^0.3.0",
                "from": {
                  "location": "/home/sogaoh3/ghq/github.com/***"
                }
              }
            ]
          }
        }
      ]
    }
  },
  "strictPeerDeps": false,
  "force": false,
  "isMine": true
}
sogaohsogaoh

とりあえず npm ci できるようになった

history

ncu 
ncu -u 
mv package-lock.json package-lock.json_
npm i
npm audit fix

npm ci

rm -f package-lock.json_
sogaohsogaoh
ビルドできず :sob:


❯ make npm-run
npm i

up to date, audited 893 packages in 2s

103 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
npm run prod

> prod
> npm run production


> production
> mix --production


✖ Mix
  Compiled with some errors in 42.83s


warn - The `purge`/`content` options have changed in Tailwind CSS v3.0.
warn - Update your configuration file to eliminate this warning.
warn - https://tailwindcss.com/docs/upgrade-guide#configure-content-sources
WARNING in ./resources/js/app.js 18:0-13
export 'default' (imported as 'Vue') was not found in 'vue' (possible exports: BaseTransition, Comment, EffectScope, Fragment, KeepAlive, ReactiveEffect, Static, Suspense, Teleport, Text, Transition, TransitionGroup, VueElement, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, compile, computed, createApp, createBlock, createCommentVNode, createElementBlock, createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, defineAsyncComponent, defineComponent, defineCustomElement, defineEmits, defineExpose, defineProps, defineSSRCustomElement, devtools, effect, effectScope, getCurrentInstance, getCurrentScope, getTransitionRawChildren, guardReactiveProps, h, handleError, hydrate, initCustomFormatter, initDirectivesForSSR, inject, isMemoSame, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isShallow, isVNode, markRaw, mergeDefaults, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, openBlock, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, ssrUtils, stop, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, transformVNodeArgs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useSSRContext, useSlots, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withMemo, withModifiers, withScopeId)

・・・

WARNING in ./resources/js/public.js 57:4-7
export 'default' (imported as 'Vue') was not found in 'vue' (possible exports: BaseTransition, Comment, EffectScope, Fragment, KeepAlive, ReactiveEffect, Static, Suspense, Teleport, Text, Transition, TransitionGroup, VueElement, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, compile, computed, createApp, createBlock, createCommentVNode, createElementBlock, createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, defineAsyncComponent, defineComponent, defineCustomElement, defineEmits, defineExpose, defineProps, defineSSRCustomElement, devtools, effect, effectScope, getCurrentInstance, getCurrentScope, getTransitionRawChildren, guardReactiveProps, h, handleError, hydrate, initCustomFormatter, initDirectivesForSSR, inject, isMemoSame, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isShallow, isVNode, markRaw, mergeDefaults, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactiva        - add a fallback 'resolve.fallback: { "stream": require.resolve("stream-browserify") }'
        - install 'stream-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "stream": false }

ERROR in ./node_modules/axios/dist/node/axios.cjs 7:13-28
Module not found: Error: Can't resolve 'http' in '/home/sogaoh3/ghq/github.com/****/node_modules/axios/dist/node'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "http": require.resolve("stream-http") }'
        - install 'stream-http'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "http": false }

ERROR in ./node_modules/axios/dist/node/axios.cjs 8:14-30
Module not found: Error: Can't resolve 'https' in '/home/sogaoh3/ghq/github.com/****/node_modules/axios/dist/node'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "https": require.resolve("https-browserify") }'
        - install 'https-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "https": false }

ERROR in ./node_modules/axios/dist/node/axios.cjs 10:13-28
Module not found: Error: Can't resolve 'zlib' in '/home/sogaoh3/ghq/github.com/****/node_modules/axios/dist/node'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "zlib": require.resolve("browserify-zlib") }'
        - install 'browserify-zlib'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "zlib": false }

ERROR in ./node_modules/axios/dist/node/axios.cjs 11:15-32
Module not found: Error: Can't resolve 'stream' in '/home/sogaoh3/ghq/github.com/****/node_modules/axios/dist/node'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "stream": require.resolve("stream-browserify") }'
        - install 'stream-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "stream": false }

webpack compiled with 8 errors and 30 warnings
make: *** [npm-run] エラー 1
sogaohsogaoh

ビルドできて、既存動作もある程度確認できた。

package.json の差分

ポイントとしては、ncu -u で一度 package.json を更新した後、以下の調整を行ったのちに package-lock.json をリネーム(退避)して npm install したところ、だろうか。これでエラーなくビルドに成功した

  • vue 関連は v2 系にとどめる(戻す)
  • axios・bootstrap を元のバージョンに戻す
このスクラップは2022/10/28にクローズされました