在您启动的第一个Nextjs14 boiler项目中,使用
npm i lnurl
字符串
安装后,
API,只是通过导入“lnurl”,发生以下错误。
Import trace for requested module:
./node_modules/lnurl/lib/subprotocols/channelRequest.js
./node_modules/lnurl/lib/subprotocols/index.js
./node_modules/lnurl/lib/Server.js
./node_modules/lnurl/index.js
./src/app/api/auth/route.ts
⚠ Fast Refresh had to perform a full reload. Read more: https://nextjs.org/docs/messages/fast-refresh-reload
⨯ ./node_modules/lnurl/lib/subprotocols/channelRequest.js
Error:
× Cannot use a reserved word as a shorthand property
╭─[/Users/mac9/project/side-p/lnurl-test/node_modules/lnurl/lib/subprotocols/channelRequest.js:41:1]
41 │ action: function(secret, params) {
42 │ return Promise.resolve().then(() => {
43 │ assert.ok(this.ln, 'Cannot execute subprotocol ("channelRequest:action"): Lightning Backend missing');
44 │ let { remoteid, localAmt, pushAmt, private } = params;
· ───────
45 │ assert.ok(remoteid, new HttpError('Missing required parameter: "remoteid"', 400));
46 │ assert.ok(typeof private !== 'undefined', new HttpError('Missing required parameter: "private"', 400));
47 │ private = parseInt(private) === 1;
╰────
× Expression expected
╭─[/Users/mac9/project/side-p/lnurl-test/node_modules/lnurl/lib/subprotocols/channelRequest.js:43:1]
43 │ assert.ok(this.ln, 'Cannot execute subprotocol ("channelRequest:action"): Lightning Backend missing');
44 │ let { remoteid, localAmt, pushAmt, private } = params;
45 │ assert.ok(remoteid, new HttpError('Missing required parameter: "remoteid"', 400));
46 │ assert.ok(typeof private !== 'undefined', new HttpError('Missing required parameter: "private"', 400));
· ───────
47 │ private = parseInt(private) === 1;
48 │ return this.executeHook('channelRequest:action', secret, params).then(() => {
49 │ // Tell the LN backend to open a new channel.
╰────
× Expected ',', got 'private'
╭─[/Users/mac9/project/side-p/lnurl-test/node_modules/lnurl/lib/subprotocols/channelRequest.js:43:1]
43 │ assert.ok(this.ln, 'Cannot execute subprotocol ("channelRequest:action"): Lightning Backend missing');
44 │ let { remoteid, localAmt, pushAmt, private } = params;
45 │ assert.ok(remoteid, new HttpError('Missing required parameter: "remoteid"', 400));
46 │ assert.ok(typeof private !== 'undefined', new HttpError('Missing required parameter: "private"', 400));
· ───────
47 │ private = parseInt(private) === 1;
48 │ return this.executeHook('channelRequest:action', secret, params).then(() => {
49 │ // Tell the LN backend to open a new channel.
╰────
Caused by:
Syntax Error
Import trace for requested module:
./node_modules/lnurl/lib/subprotocols/channelRequest.js
./node_modules/lnurl/lib/subprotocols/index.js
./node_modules/lnurl/lib/Server.js
./node_modules/lnurl/index.js
./src/app/api/auth/route.ts
⚠ Fast Refresh had to perform a full reload. Read more: https://nextjs.org/docs/messages/fast-refresh-reload
型
作为参考,它在https://github.com/jowo-io/lnurl-next-auth-demo以下的演示站点Nextjs13上运行良好
我认为lnurl不能在Nextjs中使用。
仅以下句子在Nextjs14中失败
import lnurl from 'lnurl'
型
1条答案
按热度按时间7fhtutme1#
我找到了一个变通办法。
使用
page router
编写API,而不是app rounter
字符串
只是,它的工作^^