Skip to content

Centos环境下报错:浏览器API异常 #113

Open
@stick-i

Description

我当前的环境是Centos7,我参照项目文档的Juejin Workflows 掘金工作流 这一部分,配置了相关的参数。

当我在Linux上运行时,发生了一个错误:浏览器API异常。 但我在自己的windows上,以及GithubActions上运行,都没有出现这个问题。

于是我去拉取了项目的代码,找到了这行小字所在的位置。我把这段代码的try catch给注释掉了,然后再次让它运行,它抛出了这样的异常:

[root@aliyun juejin-helper-back]# yarn
yarn install v1.22.19
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.15s.
[root@aliyun juejin-helper-back]# yarn checkin
yarn run v1.22.19
$ ts-node checkin.js
/usr/juejin/juejin-helper-back/node_modules/ts-node/src/index.ts:859
    return new TSError(diagnosticText, diagnosticCodes, diagnostics);
           ^
TSError: ⨯ Unable to compile TypeScript:
checkin.js:220:5 - error TS1434: Unexpected keyword or identifier.

220     console.log("-------------------------");
        ~~~~~~~
checkin.js:220:12 - error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.

220     console.log("-------------------------");
               ~
checkin.js:220:17 - error TS1003: Identifier expected.

220     console.log("-------------------------");
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~
checkin.js:222:1 - error TS1128: Declaration or statement expected.

222 }
    ~

    at createTSError (/usr/juejin/juejin-helper-back/node_modules/ts-node/src/index.ts:859:12)
    at reportTSError (/usr/juejin/juejin-helper-back/node_modules/ts-node/src/index.ts:863:19)
    at getOutput (/usr/juejin/juejin-helper-back/node_modules/ts-node/src/index.ts:1077:36)
    at Object.compile (/usr/juejin/juejin-helper-back/node_modules/ts-node/src/index.ts:1433:41)
    at Module.m._compile (/usr/juejin/juejin-helper-back/node_modules/ts-node/src/index.ts:1617:30)
    at Module._extensions..js (node:internal/modules/cjs/loader:1219:10)
    at Object.require.extensions.<computed> [as .js] (/usr/juejin/juejin-helper-back/node_modules/ts-node/src/index.ts:1621:12)
    at Module.load (node:internal/modules/cjs/loader:1043:32)
    at Function.Module._load (node:internal/modules/cjs/loader:878:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) {
  diagnosticCodes: [ 1434, 1068, 1003, 1128 ]
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

image

我windows上的node版本和Linux上一样,应该不是版本的问题。

我是一名Java开发者,对JS并不熟悉,希望作者能帮我看一看这个问题,非常感谢!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions