The route_page_create function is missing a callback argument for fs.close()
In route_page_create() it would appear that the fs.close() call is missing a callback argument. In Node.JS 10.10.0 at least, when the function is used to create a file, it is failing with the error:
fs.js:137
throw new ERR_INVALID_CALLBACK();
^
TypeError [ERR_INVALID_CALLBACK]: Callback must be a function
at makeCallback (fs.js:137:11)
at Object.close (fs.js:392:20)
at /Users/graham/Projects/raneto-packages/Raneto/app/routes/page.create.route.js:24:10
at FSReqWrap.oncomplete (fs.js:141:20)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `DEBUG=raneto node example/server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/graham/.npm/_logs/2018-12-08T09_36_46_542Z-debug.log
This is at the line:
fs.close(fd);
of:
app/routes/page.create.route.js
According to:
- https://nodejs.org/api/fs.html#fs_fs_close_fd_callback
the fs.close() call needs to take a callback as well as the fd.
Thus perhaps needs to be something like:
fs.close(fd, function (error) {
if (error) {
return res.json({
status : 1,
message : error
});
}
});
BTW, I am confused about the overall state of this functionality. The ability to create new pages depends on being able to see the menu on the left hand side of a page and press on the + symbol to the right of the category. The problem is that I am finding the menu never appears when using the head of the Git repo. In the version in npm packages, the menu would appear automatically when the window was wide enough, but that isn't occurring with the latest version in Git. To have the menu appear, with the intention of testing the functionality in conjunction with fixes in #280, I have had to use the browser editor to change d-none to d-block in the HTML so the menu shows.
Is the menu meant to appear, or is it hidden deliberately at the moment to block off access, given that the page creation functionality seemed to not work anyway due to the above error.
Suggested fix for this included in PR #280.
As PR #280 has been merged, which included fix for this, I believe this should be okay to close now.