Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

我是萌新 , 请问运行不起来是因为包没拉过来吗 , 里面贴了报错信息 #144

Open
2237099022 opened this issue Aug 12, 2022 · 2 comments

Comments

@2237099022
Copy link

SyntaxError: await is only valid in async function
�[90m at wrapSafe (internal/modules/cjs/loader.js:979:16)�[39m
�[90m at Module._compile (internal/modules/cjs/loader.js:1027:27)�[39m
�[90m at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)�[39m
�[90m at Module.load (internal/modules/cjs/loader.js:928:32)�[39m
�[90m at Function.Module._load (internal/modules/cjs/loader.js:769:14)�[39m
�[90m at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)�[39m
�[90m at internal/main/run_main_module.js:17:47�[39m
PS D:\Download\07\bili-api-master\bili-api-master\examples> node 1.js
D:\Download\07\bili-api-master\bili-api-master\examples\1.js:1
let object = biliAPI({ mid: 349991143 }, ['uname', 'guardNum'])
^

ReferenceError: biliAPI is not defined
at Object. (D:\Download\07\bili-api-master\bili-api-master\examples\1.js:1:14)
�[90m at Module._compile (internal/modules/cjs/loader.js:1063:30)�[39m
�[90m at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)�[39m
�[90m at Module.load (internal/modules/cjs/loader.js:928:32)�[39m
�[90m at Function.Module._load (internal/modules/cjs/loader.js:769:14)�[39m
�[90m at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)�[39m
�[90m at internal/main/run_main_module.js:17:47�[39m
PS D:\Download\07\bili-api-master\bili-api-master\examples>

@simon300000
Copy link
Owner

看起来是直接运行example/1.js了呀,这个代码首先需要import/require biliAPI
然后需要放进一个async环境,比如这样

(async () => {
// 代码放在这
})()

@2237099022
Copy link
Author

哦 谢谢你 , 聪明的大佬 , 我已经完全明白了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants