【问题标题】:JHipster - generator give 'Unexpected token' error?JHipster - 生成器给出“意外令牌”错误?
【发布时间】:2023-03-05 20:25:01
【问题描述】:

尝试在 linux mint 环境中生成一个干净的 jhipster 项目

yo jhipster

给予

/home/poc/node_modules/generator-jhipster/generators/app/index.js:15
    constructor: function (...args) { // eslint-disable-line object-shorthand
                           ^^^

SyntaxError: Unexpected token ...
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:374:25)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at Object.defineProperty.get [as jhipster:app] (/usr/local/lib/node_modules/yo/node_modules/yeoman-environment/lib/store.js:40:23)
    at Store.get (/usr/local/lib/node_modules/yo/node_modules/yeoman-environment/lib/store.js:64:35)
    at Environment.get (/usr/local/lib/node_modules/yo/node_modules/yeoman-environment/lib/environment.js:262:16)

我的

yo doctor 

给予

Yeoman Doctor
Running sanity checks on your system

✔ Global configuration file is valid
✔ NODE_PATH matches the npm root
✔ Node.js version
✔ No .bowerrc file in home directory
✔ No .yo-rc.json file in home directory
✔ npm version

我正在运行这些版本

nodejs - v4.2.6
npm    - 3.5.2
yo     - 1.8.5

有什么想法吗?

【问题讨论】:

    标签: yeoman jhipster yo


    【解决方案1】:

    你的 NodeJS 太旧,JHipster 4 需要 6.9.5,请升级 node。

    【讨论】:

    • 我在这里找到了如何升级nodejs的说明askubuntu.com/questions/695138/…
    • 你的答案是对的,它也对我有帮助,但你应该把它写在 add comment instate of in answer
    • 对我来说,仅升级节点不起作用。我也必须更新 npm 版本才能解决错误。我当前的节点版本是 10.15.3,npm 版本是 6.9.1-next.0
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-12-26
    • 1970-01-01
    • 1970-01-01
    • 2019-05-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多