请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

npm run storybook 报 Cannot read properties of undefined (reading 'length') 错误

老师能麻烦帮忙看看吗? 非常感谢!

图片描述

github 上有一个相关解决方案,
https://github.com/storybookjs/storybook/issues/14789#issuecomment-868426385
但是又有新错误出现

图片描述

这是我的 package.json

  "name": "thera-ui",
  "version": "0.1.3",
  "description": "Ready-to-use React UI library",
  "private": false,
  "main": "dist/index.es.js",
  "module": "dist/index.es.js",
  "types": "dist/index.d.ts",
  "license": "MIT",
  "keywords": [
    "UI",
    "Component",
    "React"
  ],
  "repository": {
    "type": "git",
    "url": "https://github.com/henrylong719/thera-ui"
  },
  "files": [
    "dist"
  ],
  "sideEffects": [
    "dist/index.css"
  ],
  "dependencies": {
    "@fortawesome/fontawesome-svg-core": "^6.2.1",
    "@fortawesome/free-regular-svg-icons": "^6.2.1",
    "@fortawesome/free-solid-svg-icons": "^6.2.1",
    "@fortawesome/react-fontawesome": "^0.2.0",
    "axios": "^1.2.2",
    "classnames": "^2.3.2",
    "react-transition-group": "^4.4.5",
    "uuid": "^9.0.0"
  },
  "peerDependencies": {
    "react": ">=16.8.0",
    "react-dom": ">=16.8.0"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "npm run clean && npm run build-es",
    "test": "react-scripts test --transformIgnorePatterns \"node_modules/(?!axios)/\"",
    "test:nowatch": "cross-env CI=true react-scripts test --transformIgnorePatterns \"node_modules/(?!axios)/\"",
    "clean": "rimraf ./dist",
    "lint": "eslint --ext js,ts,tsx src --max-warnings 5",
    "eject": "react-scripts eject",
    "build-ts": "tsc -p tsconfig.build.json",
    "build-css": "node-sass ./src/styles/index.scss ./dist/index.css",
    "storybook": "BROWSER=none start-storybook -p 6006",
    "build-storybook": "build-storybook",
    "build-es": "rollup --config rollup/rollup.esm.config.mjs",
    "prepublishOnly": "npm run test:nowatch && npm run lint && npm run build"
  },
  "husky": {
    "hooks": {
      "pre-push": "npm run test:nowatch && npm run lint"
    }
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ],
    "overrides": [
      {
        "files": [
          "**/*.stories.*"
        ],
        "rules": {
          "import/no-anonymous-default-export": "off"
        }
      }
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "devDependencies": {
    "@rollup/plugin-commonjs": "^24.0.0",
    "@rollup/plugin-json": "^6.0.0",
    "@rollup/plugin-node-resolve": "^15.0.1",
    "@storybook/addon-actions": "^6.5.15",
    "@storybook/addon-essentials": "^6.4.22",
    "@storybook/addon-interactions": "^6.5.15",
    "@storybook/addon-links": "^6.5.15",
    "@storybook/builder-webpack5": "^6.5.15",
    "@storybook/manager-webpack5": "^6.5.15",
    "@storybook/node-logger": "^6.5.15",
    "@storybook/preset-create-react-app": "^4.1.2",
    "@storybook/react": "^6.1.21",
    "@storybook/testing-library": "^0.0.13",
    "@testing-library/jest-dom": "^5.16.5",
    "@testing-library/react": "^13.4.0",
    "@testing-library/user-event": "^13.5.0",
    "@types/classnames": "^2.3.1",
    "@types/jest": "^27.5.2",
    "@types/node": "^16.18.0",
    "@types/react": "^18.0.22",
    "@types/react-dom": "^18.0.7",
    "@types/react-transition-group": "^4.4.5",
    "@types/uuid": "^9.0.0",
    "@types/webpack": "^5.28.0",
    "babel-plugin-named-exports-order": "^0.0.2",
    "cross-env": "^7.0.3",
    "css-loader": "^6.7.3",
    "husky": "^4.2.1",
    "node-sass": "^8.0.0",
    "prop-types": "^15.8.1",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-scripts": "^4.0.3",
    "rimraf": "^3.0.2",
    "rollup": "^3.9.0",
    "rollup-plugin-exclude-dependencies-from-bundle": "^1.1.23",
    "rollup-plugin-sass": "^1.12.17",
    "rollup-plugin-typescript2": "^0.34.1",
    "style-loader": "^3.3.1",
    "tslib": "^2.4.1",
    "typescript": "^4.9.4",
    "web-vitals": "^2.1.4",
    "sass": "^1.51.0",
    "sass-loader": "^12.6.0",
    "webpack": "^5.72.0"
  }
}
`




正在回答 回答被采纳积分+3

1回答

张轩 2023-01-09 09:42:23

同学你好

请提供一下你的代码库(git),我在本地帮你调试看看。

0 回复 有任何疑惑可以回复我~
  • 提问者 慕勒0567464 #1
    我的代码库是这个,
    
    https://github.com/henrylong719/thera-ui
    
    非常感谢老师!
    回复 有任何疑惑可以回复我~ 2023-01-09 10:45:06
问题已解决,确定采纳
还有疑问,暂不采纳
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号