syntaxhighlighter: Building: loadReposFromCache(...).error is not a function
I get the following error when running ./node_modules/gulp/bin/gulp.js setup-project
:
[16:44:12] Requiring external module babel-register [16:44:12] Using gulpfile /tmp/syntaxhighlighter/gulpfile.babel.js [16:44:12] Starting ‘setup-project:clone-repos’… [16:44:12] ‘setup-project:clone-repos’ errored after 788 μs [16:44:12] TypeError: loadReposFromCache(…).error is not a function at loadRepos (/tmp/syntaxhighlighter/build/setup-project.js:39:48) at Gulp.<anonymous> (/tmp/syntaxhighlighter/build/setup-project.js:48:5) at module.exports (/tmp/syntaxhighlighter/node_modules/orchestrator/lib/runTask.js:34:7) at Gulp.Orchestrator._runTask (/tmp/syntaxhighlighter/node_modules/orchestrator/index.js:273:3) at Gulp.Orchestrator._runStep (/tmp/syntaxhighlighter/node_modules/orchestrator/index.js:214:10) at Gulp.Orchestrator.start (/tmp/syntaxhighlighter/node_modules/orchestrator/index.js:134:8) at /tmp/syntaxhighlighter/node_modules/gulp/bin/gulp.js:129:20 at _combinedTickCallback (internal/process/next_tick.js:131:7) at process._tickCallback (internal/process/next_tick.js:180:9) at Function.Module.runMain (module.js:655:11) (node:18176) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: ENOENT: no such file or directory, open ‘/tmp/syntaxhighlighter/.projects-cache.json’ (node:18176) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
I followed exactly the steps described at https://github.com/syntaxhighlighter/syntaxhighlighter/wiki/Building. Using npm 5.5.1-1 on ArchLinux. I also tried installing the git and github module manually, but nothing changed.
About this issue
- Original URL
- State: open
- Created 7 years ago
- Reactions: 7
- Comments: 16
Here’s what worked for me…
After installing npm dependencies, go into node_modules/songbird/lib/songbird.js and change
Promise = global.Promise || require("bluebird");
to
Promise = require("bluebird");
This will make sure the extensions for Promise are available.
I’ve used @nstublen workaround to create a docker image to build syntaxhighlighter and also add custom brushes / themes if you want to take a look : https://github.com/crazy-max/docker-syntaxhighlighter
I fixed this issue by changing .error in the following line to .catch
const loadRepos = () => loadReposFromCache().error(loadReposFromGitHub).then(R.map(R.pick([‘ssh_url’, ‘name’])));
Line 39 of setup-projects.js
However there were other things that I had to do to get a full build working.
Hey folks, came up with a quick workaround since I’m just trying to get a basic build working and I know more about Python than I do about Node. This probably only works on any Linux, regardless of Python version, but I have only tested my personal Ubuntu. You can probably change the calls to
os.symlink
to some form ofsubprocess.call
to get it working on Mac or Windows.Dump the following code into a
setup-this-project-without-node.py
in the root directory of the project and run it however you’d like. It performs the exact same steps that thegulp setup-project
does.After applying @nstublen 's fix to songbird.js, I was able to run a successful build.
This looks to be part of a batch of issues with Promises in the setup-project and bundle scripts.
I’ve got this to build and committed to a fork here: https://github.com/karljacuncha/syntaxhighlighter/commit/dc015fa299d4d249e8518664e205a838c55372cf
For this specific issue, you could remove/skip the loadReposFromCache, and always load from GitHub Repo:
This will still crap out, but you should have enough to move onto the build at that stage