question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

🐛[BUG]Module not found: Error: Can't resolve 'btoa'

See original GitHub issue

🐛 bug 描述

npx create-umi myapp
cd myapp/
npm install
npm run start
后端提示:
 ERROR  Failed to compile with 1 errors                                                         12:29:51 PM

 error  in ./node_modules/swagger-ui-react/swagger-ui.js

Module not found: Error: Can't resolve 'btoa' in '/home/ubuntu/adp/myapp/node_modules/swagger-ui-react'


● MFSU █████████████████████████ cache (99%)
 begin idle

✔ Webpack


ERROR in ./node_modules/swagger-ui-react/swagger-ui.js 2:107055-107070
Module not found: Error: Can't resolve 'btoa' in '/home/ubuntu/adp/myapp/node_modules/swagger-ui-react'
 @ ./node_modules/swagger-ui-react/index.js 13:0-61 59:15-35 65:53-65
 @ ./src/.umi/.cache/.mfsu/mf-va_swagger-ui-react.js 1:0-33 2:15-16
 @ container entry ./swagger-ui-react[0]

webpack compiled with 1 error
null
Error: build failed
    at /home/ubuntu/adp/m ya l l/node_modules/@umijs/bundler-webpack/lib/index.js:172:29
    at /home/ubuntu/adp/myap p/node_modules/@umijs/deps/compiled/webpack/5/bundle5.js:114591:14
    at processQueueWorker (/home/ubuntu/adp/myapp/node_modules/@umijs/deps/compiled/webpack/5/bundle5.js:114529:6)
    at processTicksAndRejections (node:internal/process/task_queues:78:11)

📷 复现步骤

npx create-umi myapp
cd myapp/
npm install
npm run start

🏞 期望结果

正确编译

💻 复现代码

© 版本信息

  • Ant Design Pro 版本: 5.2.0
  • umi 版本: unknown
  • 浏览器环境: chrome 101
  • 开发环境: ubuntu 18.04

🚑 其他信息

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:12 (1 by maintainers)

github_iconTop GitHub Comments

16reactions
pengyuweicommented, May 9, 2022
yarn add swagger-ui-react
yarn start

问题解决

3reactions
pikaduncommented, May 19, 2022

把openapi,swagger相关代码都删掉就行了

Read more comments on GitHub >

github_iconTop Results From Across the Web

Node.js throws "btoa is not defined" error - Stack Overflow
The new directory showed up in my node_modules folder, which itself is in root alongside app.js . Then I made sure to add...
Read more >
船长在船上 - CSDN博客
Module not found : Error: Can't resolve 'btoa' in ... 构建Ant-Design-Pro 框架出现Error: Cannot find module 'eslint-config-prettier/@typescrip.
Read more >
Converse.js API Documentation Source: headless/dist ...
function btoa(s) { if (arguments.length === 0) { throw new TypeError("1 argument required, but only 0 present."); } let i; // String conversion...
Read more >
JavaScript - Tanker documentation
The encountered error is: Module not found: Error: Can't resolve 'fs'. As a workaround, you can add the following to your Webpack configuration:...
Read more >
module-not-found - Next.js
Why This Error Occurred · The module you're trying to import is not installed in your dependencies · The module you're trying to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found