【问题标题】:There is a problem when running a node application on ubuntu 18.04在ubuntu 18.04上运行node应用时出现问题
【发布时间】:2021-04-23 14:30:11
【问题描述】:

我正在尝试在 azure VM 上运行节点站点,但运行时出现此错误 > SkyCrypt@1.0.0 start

> node init && node index

internal/modules/cjs/loader.js:1109
    throw err;
    ^

SyntaxError: /home/nim1com/SkyCrypt/credentials.json: Unexpected token v in JSON at position 216
    at parse (<anonymous>)
    at Object.Module._extensions..json (internal/modules/cjs/loader.js:1106:22)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/home/nim1com/SkyCrypt/init.js:15:21)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! SkyCrypt@1.0.0 start: `node init && node index`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the SkyCrypt@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/nim1com/.npm/_logs/2021-01-19T09_41_40_472Z-debug.log```

这个问题的答案是什么?我试过删除 package-lock.json 和 node_modules

凭据.json

{
    "hypixel_api_key": "26ed366f-80ed-4b49-b912-ef46292c6225",
    "recaptcha_site_key": "",
    "recaptcha_secret_key": "",
    "dbUrl": "mongodb+srv://dbStats:*********@cluster0.4kwsp.mongodb.net/test?retryWrites=true&w=majority",
    "dbName": vmstats",
    "session_secret": "36e47c144b9b9b3e0b9c8bf24c6ac2860c0f76a55b74dcea4007bf355af76789"
}

【问题讨论】:

  • 读取错误它抱怨"dbName": vmstats", 中的v 因为不是有效的json

标签: node.js mongodb npm node-modules


【解决方案1】:

阅读错误,它抱怨“dbName”中的 v:vmstats”,因为不是有效的 json – Lawrence Cherone

【讨论】:

    【解决方案2】:

    您的 /home/nim1com/SkyCrypt/credentials.json 文件似乎需要更正...

    【讨论】:

      猜你喜欢
      • 2019-02-16
      • 2020-08-08
      • 1970-01-01
      • 2020-08-02
      • 1970-01-01
      • 2020-10-29
      • 1970-01-01
      • 2020-08-28
      • 1970-01-01
      相关资源
      最近更新 更多