JHipster - 发生器给出了意想不到的令牌'错误?

时间:2017-03-28 15:37:01

标签: yeoman jhipster yo

尝试在linux mint env上生成一个干净的jhipster项目

/* global it, expect, describe */

import React from 'react'
import { shallow } from 'enzyme'
import renderer from 'react-test-renderer'
import About from '../pages/about.js'

describe('With Enzyme', () => {
  it('App shows "About"', () => {
    const about = shallow(
      <About />
    ).dive()
    expect(about.find('h1').text()).toEqual('About')
  })
})

给出

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

有什么想法吗?

1 个答案:

答案 0 :(得分:7)

你的NodeJS太旧了,JHipster 4需要6.9.5,请升级节点。