Issue #338: Upgrading 0.3.x to 0.4.0 : kallithea-cli front-end-build throws error: "Unexpected Token"
| Reported by: | Edmund Wong |
| State: | resolved |
| Created on: | 2019-04-01 09:05 |
| Updated on: | 2019-04-03 16:03 |
Description
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
Attachments
Comments
Comment by Edmund Wong, on 2019-04-01 09:09
Comment by Edmund Wong, on 2019-04-01 09:10
Comment by Edmund Wong, on 2019-04-01 09:13
Comment by Thomas De Schampheleire, on 2019-04-01 09:15
Comment by Thomas De Schampheleire, on 2019-04-01 09:22
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.
Comment by Edmund Wong, on 2019-04-01 09:32
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.
Comment by Edmund Wong, on 2019-04-01 09:32
Resolving as it was a PEBCAK error.
Comment by Thomas De Schampheleire, on 2019-04-01 09:52
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.
Comment by Mads Kiilerich, on 2019-04-02 00:32
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.
Comment by Edmund Wong, on 2019-04-03 01:49
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
Comment by Mads Kiilerich, on 2019-04-03 16:03
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.