Upgrading 0.3.x to 0.4.0 : kallithea-cli front-end-build throws error: "Unexpected Token"

Issue #338 resolved
Edmund Wong created an issue

During upgrading from a 0.3.x instance to a 0.4.0 instance, I'm getting the following error when I run "kallithea-cli front-end-build":

/var/www/environments/kalivenv/lib/python2.7/site-packages/kallithea/front-end/node_modules/license-checker/node_modules/read-installed/node_modules/read-package-json/read-json.js:390
      fs.stat(binPath, (err) => handleExists(relName, !err))
                              ^
    SyntaxError: Unexpected token >
        at Module._compile (module.js:439:25)
        at Object.Module._extensions..js (module.js:474:10)
        at Module.load (module.js:356:32)
        at Function.Module._load (module.js:312:12)
        at Module.require (module.js:364:17)
        at require (module.js:380:17)
        at Object.<anonymous> (/var/www/environments/kalivenv/lib/python2.7/site-packages/kallithea/front-end/node_modules/license-checker/node_modules/read-installed/read-installed.js:99:16)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
Traceback (most recent call last):
  File "/var/www/environments/kalivenv/bin/kallithea-cli", line 11, in <module>
    load_entry_point('Kallithea', 'console_scripts', 'kallithea-cli')()
  File "/var/www/environments/kalivenv/lib/python2.7/site-packages/Click-7.0-py2.7.egg/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/var/www/environments/kalivenv/lib/python2.7/site-packages/Click-7.0-py2.7.egg/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/var/www/environments/kalivenv/lib/python2.7/site-packages/Click-7.0-py2.7.egg/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/var/www/environments/kalivenv/lib/python2.7/site-packages/Click-7.0-py2.7.egg/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/var/www/environments/kalivenv/lib/python2.7/site-packages/Click-7.0-py2.7.egg/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/var/www/environments/kalivenv/lib/python2.7/site-packages/kallithea/bin/kallithea_cli_front_end.py", line 97, in front_end_build
    cwd=front_end_dir, shell=kallithea.is_windows)
  File "/opt/python27/lib/python2.7/subprocess.py", line 190, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/var/www/environments/kalivenv/lib/python2.7/site-packages/kallithea/front-end/node_modules/.bin/license-checker', '--json', '--out', '/var/www/environments/kalivenv/lib/python2.7/site-packages/kallithea/front-end/tmp/licensing.json']' returned non-zero exit status 8

Comments (11)

  1. Thomas De Schampheleire

    What are the versions you have for npm and node? On my side I have:

    > npm --version                                                                      
    6.4.1
    > node --version                                                                     
    v8.12.0
    

    In the file 'read-json.js', I also have that '=>' syntax, but it does not give any problem. I therefore suspect you have an older version of node.

    What is also different in the output is that packages are installed nested in your case:

    kallithea/front-end/node_modules/license-checker/node_modules/read-installed/node_modules/read-package-json/read-json.js:390

    In my case, the file is at: kallithea/front-end/node_modules/read-package-json/read-json.js

    I assume this is also related to the version of npm.

  2. Edmund Wong reporter

    Apparently I had installed the wrong version of nodejs... an old version. Just fixed that and now it works.

    So closing this.

    Sorry for the noise.

  3. Thomas De Schampheleire

    Do you still know which npm/node version was the old one, and which is the new? It could be useful later for other people, thanks.

  4. Mads Kiilerich

    It seems like a "npm" issue if it happily is installing packages that doesn't work in the environment. But I guess we have to be prepared for that. Perhaps by adding a check for supported npm versions in front-end-build? Or at least be explicit about a minimum version in the documentation.

  5. Edmund Wong reporter

    the node and npm versions were very old as I had used the "yum install nodejs" which installs the old-as-heck nodejs from the yum repos.

    The versions are: node: 0.10.48 npm: 1.3.6

  6. Mads Kiilerich

    We should perhaps have code in front-end-build that warns/fails if version is too old. Whatever limit is right - that might need some experiments.

  7. Log in to comment