Skip to content

在 NEXTJS 中引用 node-sdk 出现 proxy-agent 等包 not found【原因: 浏览器代码逻辑中也引用了 node-sdk, 因 node-sdk 依赖 node 环境所以报错(浏览器中无 node 环境)】 #443

@ZachZQY

Description

@ZachZQY

functorz@functorzdeMacBook-Pro zeelink-campus % pnpm run dev

zeelink-campus@0.1.0 dev /Users/functorz/Documents/GitHub/self-operated-products/zeelink-campus
next dev --turbopack

▲ Next.js 15.2.3 (Turbopack)

✓ Starting...
✓ Ready in 1565ms
○ Compiling / ...
✓ Compiled / in 3.7s
GET /?ide_webview_request_time=1742746198804 200 in 4217ms
○ Compiling /posts/publish ...
✓ Compiled /posts/publish in 1607ms
GET /posts/publish 200 in 1877ms
○ Compiling /api/qiniu/upload ...
✓ Compiled /api/qiniu/upload in 1786ms
⨯ ./node_modules/.pnpm/urllib@2.44.0/node_modules/urllib/lib/detect_proxy_agent.js:24:44
Module not found: Can't resolve 'proxy-agent'
22 | debug('create new proxy %s', proxy);
23 | // lazy require, only support node >= 4

24 | proxyAgent = proxyAgents[proxy] = new (require('proxy-agent'))(proxy);
| ^^^^^^^^^^^^^^^^^^^^^^
25 | }
26 | debug('get proxy: %s', proxy);
27 | return proxyAgent;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions