Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Background build crashes if I visit another page soon after #1619

Closed
damithc opened this issue Jun 29, 2021 · 19 comments
Closed

Background build crashes if I visit another page soon after #1619

damithc opened this issue Jun 29, 2021 · 19 comments

Comments

@damithc
Copy link
Contributor

damithc commented Jun 29, 2021

Steps to reproduce locally:

  1. clone https://github.com/nus-cs2103-AY2021S2/website
  2. clone the submodule, as explained in the README
  3. checkout the branch cs2103
  4. run markbind serve -o -b
  5. after the landing page is loaded, click on a few other links in the site-nav.

The error:

warn: message=UNKNOWN: unknown error, open 'C:\repos\nus-cs2103\cs2103-website-base_site\siteData.json', stack=Error: UNKNOWN: unknown error, open 'C:\repos\nus-cs2103\cs2103-website-base_site\siteData.json', errno=-4094, code=UNKNOWN, syscall=open, path=C:\repos\nus-cs2103\cs2103-website-base_site\siteData.json
error: message=ENOENT: no such file or directory, open 'C:\repos\nus-cs2103\cs2103-website-base_site\book\principles\separationOfConcernsPrinciple\unit-inElsewhere-asFlat.include.html', stack=Error: ENOENT: no such file or directory, open 'C:\repos\nus-cs2103\cs2103-website-base_site\book\principles\separationOfConcernsPrinciple\unit-inElsewhere-asFlat.include.html'
at Object.openSync (fs.js:498:3)
at Object.readFileSync (fs.js:394:35)
at Object. (C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\node_modules@markbind\core\src\Page\index.js:277:37)
at initialize.exports.each (C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\node_modules\cheerio\lib\api\traversing.js:300:24)
at Page.collectHeadingsAndKeywordsInContent (C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\node_modules@markbind\core\src\Page\index.js:254:8)
at Object. (C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\node_modules@markbind\core\src\Page\index.js:292:16)
at initialize.exports.each (C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\node_modules\cheerio\lib\api\traversing.js:300:24)
at Page.collectHeadingsAndKeywordsInContent (C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\node_modules@markbind\core\src\Page\index.js:254:8)
at Object. (C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\node_modules@markbind\core\src\Page\index.js:292:16)
at initialize.exports.each (C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\node_modules\cheerio\lib\api\traversing.js:300:24)
at Page.collectHeadingsAndKeywordsInContent (C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\node_modules@markbind\core\src\Page\index.js:254:8)
at Object. (C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\node_modules@markbind\core\src\Page\index.js:292:16)
at initialize.exports.each (C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\node_modules\cheerio\lib\api\traversing.js:300:24)
at Page.collectHeadingsAndKeywordsInContent (C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\node_modules@markbind\core\src\Page\index.js:254:8)
at Object. (C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\node_modules@markbind\core\src\Page\index.js:292:16)
at initialize.exports.each (C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\node_modules\cheerio\lib\api\traversing.js:300:24), errno=-4058, syscall=open, code=ENOENT, path=C:\repos\nus-cs2103\cs2103-website-base_site\book\principles\separationOfConcernsPrinciple\unit-inElsewhere-asFlat.include.html
Unhandled rejection Error: Error while generating undefined
at C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\node_modules@markbind\core\src\Site\index.js:1175:18
error: message=ENOENT: no such file or directory, open 'C:\repos\nus-cs2103\cs2103-website-base_site\book\oop\inheritance\what\unit-inElsewhere-asFlat.include.html', stack=Error: ENOENT: no such file or directory, open 'C:\repos\nus-cs2103\cs2103-website-base_site\book\oop\inheritance\what\unit-inElsewhere-asFlat.include.html'
at Object.openSync (fs.js:498:3)
at Object.readFileSync (fs.js:394:35)
at Object. (C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\node_modules@markbind\core\src\Page\index.js:277:37)
at initialize.exports.each (C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\node_modules\cheerio\lib\api\traversing.js:300:24)
at Page.collectHeadingsAndKeywordsInContent (C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\node_modules@markbind\core\src\Page\index.js:254:8)
at Object. (C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\node_modules@markbind\core\src\Page\index.js:288:18)
at initialize.exports.each (C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\node_modules\cheerio\lib\api\traversing.js:300:24)
at Page.collectHeadingsAndKeywordsInContent (C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\node_modules@markbind\core\src\Page\index.js:254:8)
at Page.collectHeadingsAndKeywords (C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\node_modules@markbind\core\src\Page\index.js:232:10)
at Page.generate (C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\node_modules@markbind\core\src\Page\index.js:489:10)
at async C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\node_modules@markbind\core\src\Site\index.js:1167:11, errno=-4058, syscall=open, code=ENOENT, path=C:\repos\nus-cs2103\cs2103-website-base_site\book\oop\inheritance\what\unit-inElsewhere-asFlat.include.html
error: message=ENOENT: no such file or directory, open 'C:\repos\nus-cs2103\cs2103-website-base_site\book\oop\inheritance\what\unit-inElsewhere-asFlat.include.html', stack=Error: ENOENT: no such file or directory, open 'C:\repos\nus-cs2103\cs2103-website-base_site\book\oop\inheritance\what\unit-inElsewhere-asFlat.include.html'
at Object.openSync (fs.js:498:3)
at Object.readFileSync (fs.js:394:35)
at Object. (C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\node_modules@markbind\core\src\Page\index.js:277:37)
at initialize.exports.each (C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\node_modules\cheerio\lib\api\traversing.js:300:24)
at Page.collectHeadingsAndKeywordsInContent (C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\node_modules@markbind\core\src\Page\index.js:254:8)
at Object. (C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\node_modules@markbind\core\src\Page\index.js:292:16)
at initialize.exports.each (C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\node_modules\cheerio\lib\api\traversing.js:300:24)
at Page.collectHeadingsAndKeywordsInContent (C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\node_modules@markbind\core\src\Page\index.js:254:8)
at Object. (C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\node_modules@markbind\core\src\Page\index.js:292:16)
at initialize.exports.each (C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\node_modules\cheerio\lib\api\traversing.js:300:24)
at Page.collectHeadingsAndKeywordsInContent (C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\node_modules@markbind\core\src\Page\index.js:254:8)
at Object. (C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\node_modules@markbind\core\src\Page\index.js:292:16)
at initialize.exports.each (C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\node_modules\cheerio\lib\api\traversing.js:300:24)
at Page.collectHeadingsAndKeywordsInContent (C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\node_modules@markbind\core\src\Page\index.js:254:8)
at Page.collectHeadingsAndKeywords (C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\node_modules@markbind\core\src\Page\index.js:232:10)
at Page.generate (C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\node_modules@markbind\core\src\Page\index.js:489:10), errno=-4058, syscall=open, code=ENOENT, path=C:\repos\nus-cs2103\cs2103-website-base_site\book\oop\inheritance\what\unit-inElsewhere-asFlat.include.html
error: message=ENOENT: no such file or directory, open 'C:\repos\nus-cs2103\cs2103-website-base_site\book\oop\objects\encapsulation\unit-inElsewhere-asFlat.include.html', stack=Error: ENOENT: no such file or directory, open 'C:\repos\nus-cs2103\cs2103-website-base_site\book\oop\objects\encapsulation\unit-inElsewhere-asFlat.include.html'
at Object.openSync (fs.js:498:3)
at Object.readFileSync (fs.js:394:35)
at Object. (C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\node_modules@markbind\core\src\Page\index.js:277:37)
at initialize.exports.each (C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\node_modules\cheerio\lib\api\traversing.js:300:24)
at Page.collectHeadingsAndKeywordsInContent (C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\node_modules@markbind\core\src\Page\index.js:254:8)
at Object. (C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\node_modules@markbind\core\src\Page\index.js:292:16)
at initialize.exports.each (C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\node_modules\cheerio\lib\api\traversing.js:300:24)
at Page.collectHeadingsAndKeywordsInContent (C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\node_modules@markbind\core\src\Page\index.js:254:8)
at Object. (C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\node_modules@markbind\core\src\Page\index.js:292:16)
at initialize.exports.each (C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\node_modules\cheerio\lib\api\traversing.js:300:24)
at Page.collectHeadingsAndKeywordsInContent (C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\node_modules@markbind\core\src\Page\index.js:254:8)
at Object. (C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\node_modules@markbind\core\src\Page\index.js:292:16)
at initialize.exports.each (C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\node_modules\cheerio\lib\api\traversing.js:300:24)
at Page.collectHeadingsAndKeywordsInContent (C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\node_modules@markbind\core\src\Page\index.js:254:8)
at Object. (C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\node_modules@markbind\core\src\Page\index.js:292:16)
at initialize.exports.each (C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\node_modules\cheerio\lib\api\traversing.js:300:24), errno=-4058, syscall=open, code=ENOENT, path=C:\repos\nus-cs2103\cs2103-website-base_site\book\oop\objects\encapsulation\unit-inElsewhere-asFlat.include.html

Let me know if you are unable to reproduce...

@wxwxwxwx9
Copy link
Contributor

Hmm, I wasn't able to replicate this (the crash). Seems to be working fine for me. Perhaps others can try replicating this.

@ryoarmanda
Copy link
Contributor

ryoarmanda commented Jul 3, 2021

Couldn't reproduce this as well, but so far I have only tried it in one run. My current guess that this is probably an intermittent issue caused by the asynchronous nature of the page generation.

We can still investigate this further by trying multiple runs or reading from the provided stack trace. @damithc have you experienced this error/crash quite consistently or is it just a one-off so far?

@damithc
Copy link
Contributor Author

damithc commented Jul 3, 2021

Turns out it has nothing to do with clicking. The the command fails on its own (without any clicking) after a while with the given error. And it seems to happen almost every time (happened 5/5 most recent tries).

@ryoarmanda
Copy link
Contributor

ryoarmanda commented Jul 7, 2021

I tried to run the background build without interruption and it still cleanly finishes... it's a tricky problem here, I would need to make do with just the error trace (I don't want to readily say there's nothing we can do for this).

Here is my investigation on this:

From the trace, there's a warn log about an unknown error in opening the siteData file, then there's a bunch of no such file error following it, each corresponding to an asynchronous page generation callback, and an unhandled rejection error. The crash might be able to be explained by the unhandled rejection error (iirc node would crash if it happens).

I see that FS operation regarding siteData is only done in one method so the warn log is probably from there. In the method, if it happens to encounter error in writing the siteData, it will call a utility function to print out a warn log of the error, and then removes the entire output folder's contents. Knowing our circumstances, this can explain the reason of all the rejections. All of the callbacks can't find some generated files because all of the files are already gone.

I'm not sure yet of the reason of the FS error, but I think it's probably because of IO race conditions / overwhelming requests to access it, since in background build, we write the siteData after each page build to ensure search data is up to date (which in retrospect, we can do better than this approach).

TL;DR - The crash is likely because of the unhandled rejections. The catalyst of the rejections is probably overwhelming requests to write siteData after each page build, which causes FS error, and the error-handling calls a utility function that deletes the whole output folder's contents, hence why page generation callbacks throws file not found errors and rejects.

This is just my speculation, but it's a good start. I have a trial PR to test whether this is the case. In it, I just disabled the "write to siteData" call after each page build, handle rejections when it happens, and fix an error message so that it properly outputs the filepath. I also added an extra warn log to give a heads up whether the utility function is called.

As unfortunately you are the only one we know that can reproduce the errors reliably, I might need to ask your help in checking whether the cause is correct (not ideal I know... :/). If you have the time, can you please check out the trial PR and try to do the background build from there, see if the error persists?

If you have the MarkBind repo cloned, you can checkout the trial PR by:

git fetch origin pull/1632/head:1632-trial
git checkout 1632-trial

@damithc
Copy link
Contributor Author

damithc commented Jul 7, 2021

Thanks for the follow up work @ryoarmanda
Will give it a try and let you know how it goes.

@damithc
Copy link
Contributor Author

damithc commented Jul 7, 2021

@ryoarmanda here's the error message I got from this version.

  • BTW, the precise version of the CS2103 website I'm using is https://github.com/nus-cs2103/website-base
  • I linked my MarkBind to the version in this PR for this experiment but how to confirm (as there is no change in behavior)?. Perhaps you can put some extra log messages in this version to confirm that I'm using the correct version by looking at the log output?

v3.0.4
info: Website generation (lazy) started at 2:06:58 am
info: Building assets...
info: Assets built
info: Generating landing page...
info: Landing page built, other pages will be built as you navigate to them!
info: Site data built
info: Website generation (lazy) complete! Total build time: 18.529s
info: Serving "C:\repos\nus-cs2103\cs2103-website-base_site" at http://127.0.0.1:8080
info: Press CTRL+C to stop ...
info: Building files that are not viewed in the background...
Deprecated as of 10.7.0. highlight(lang, code, ...args) has been deprecated.
Deprecated as of 10.7.0. Please use highlight(code, options) instead.
highlightjs/highlight.js#2277
warn: message=UNKNOWN: unknown error, open 'C:\repos\nus-cs2103\cs2103-website-base_site\siteData.json', stack=Error: UNKNOWN: unknown error, open 'C:\repos\nus-cs2103\cs2103-website-base_site\siteData.json', errno=-4094, code=UNKNOWN, syscall=open, path=C:\repos\nus-cs2103\cs2103-website-base_site\siteData.json
error: Failed to copy asset markbind-plugin-anchors.css for plugin markbind-plugin-anchors
Error: ENOENT: no such file or directory, mkdir 'C:\repos\nus-cs2103\cs2103-website-base_site\plugins\markbind-plugin-anchors'
ERROR: Error: EPERM: operation not permitted, watch 'C:\repos\nus-cs2103\cs2103-website-base_site\book\designFundamentals\coupling\how'
at FSWatcher. (internal/fs/watchers.js:218:26)
at Object.watch (fs.js:1582:34)
at createFsWatchInstance (C:\repos\markbind\markbind\packages\cli\node_modules\chokidar\lib\nodefs-handler.js:119:15)
at setFsWatchListener (C:\repos\markbind\markbind\packages\cli\node_modules\chokidar\lib\nodefs-handler.js:166:15)
at NodeFsHandler._watchWithNodeFs (C:\repos\markbind\markbind\packages\cli\node_modules\chokidar\lib\nodefs-handler.js:331:14)
at NodeFsHandler._handleDir (C:\repos\markbind\markbind\packages\cli\node_modules\chokidar\lib\nodefs-handler.js:559:19)
at runMicrotasks ()
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async NodeFsHandler._addToNodeFs (C:\repos\markbind\markbind\packages\cli\node_modules\chokidar\lib\nodefs-handler.js:609:16) {
errno: -4048,
syscall: 'watch',
code: 'EPERM',
path: 'C:\repos\nus-cs2103\cs2103-website-base\_site\book\designFundamentals\coupling\how',
filename: 'C:\repos\nus-cs2103\cs2103-website-base\_site\book\designFundamentals\coupling\how'
}
error: message=ENOENT: no such file or directory, open 'C:\repos\nus-cs2103\cs2103-website-base_site\book\cppToJava\misc\constants\index.html', stack=Error: ENOENT: no such file or directory, open 'C:\repos\nus-cs2103\cs2103-website-base_site\book\cppToJava\misc\constants\index.html', errno=-4058, code=ENOENT, syscall=open, path=C:\repos\nus-cs2103\cs2103-website-base_site\book\cppToJava\misc\constants\index.html
Unhandled rejection Error: Error while generating undefined
at C:\repos\markbind\markbind\packages\cli\node_modules@markbind\core\src\Site\index.js:1175:18
error: message=ENOENT: no such file or directory, open 'C:\repos\nus-cs2103\cs2103-website-base_site\book\cppToJava\inheritance\basic\index.html', stack=Error: ENOENT: no such file or directory, open 'C:\repos\nus-cs2103\cs2103-website-base_site\book\cppToJava\inheritance\basic\index.html', errno=-4058, code=ENOENT, syscall=open, path=C:\repos\nus-cs2103\cs2103-website-base_site\book\cppToJava\inheritance\basic\index.html
error: message=ENOENT: no such file or directory, open 'C:\repos\nus-cs2103\cs2103-website-base_site\book\cppToJava\inheritance\index.html', stack=Error: ENOENT: no such file or directory, open 'C:\repos\nus-cs2103\cs2103-website-base_site\book\cppToJava\inheritance\index.html', errno=-4058, code=ENOENT, syscall=open, path=C:\repos\nus-cs2103\cs2103-website-base_site\book\cppToJava\inheritance\index.html
error: message=ENOENT: no such file or directory, open 'C:\repos\nus-cs2103\cs2103-website-base_site\book\uml\objectDiagrams\introduction\unit-inElsewhere-asFlat.include.html', stack=Error: ENOENT: no such file or directory, open 'C:\repos\nus-cs2103\cs2103-website-base_site\book\uml\objectDiagrams\introduction\unit-inElsewhere-asFlat.include.html'
at Object.openSync (fs.js:498:3)
at Object.readFileSync (fs.js:394:35)
at Object. (C:\repos\markbind\markbind\packages\cli\node_modules@markbind\core\src\Page\index.js:277:37)
at initialize.exports.each (C:\repos\markbind\markbind\packages\cli\node_modules\cheerio\lib\api\traversing.js:300:24)
at Page.collectHeadingsAndKeywordsInContent (C:\repos\markbind\markbind\packages\cli\node_modules@markbind\core\src\Page\index.js:254:8)
at Object. (C:\repos\markbind\markbind\packages\cli\node_modules@markbind\core\src\Page\index.js:288:18)
at initialize.exports.each (C:\repos\markbind\markbind\packages\cli\node_modules\cheerio\lib\api\traversing.js:300:24)
at Page.collectHeadingsAndKeywordsInContent (C:\repos\markbind\markbind\packages\cli\node_modules@markbind\core\src\Page\index.js:254:8)
at Object. (C:\repos\markbind\markbind\packages\cli\node_modules@markbind\core\src\Page\index.js:292:16)
at initialize.exports.each (C:\repos\markbind\markbind\packages\cli\node_modules\cheerio\lib\api\traversing.js:300:24)
at Page.collectHeadingsAndKeywordsInContent (C:\repos\markbind\markbind\packages\cli\node_modules@markbind\core\src\Page\index.js:254:8)
at Object. (C:\repos\markbind\markbind\packages\cli\node_modules@markbind\core\src\Page\index.js:292:16)
at initialize.exports.each (C:\repos\markbind\markbind\packages\cli\node_modules\cheerio\lib\api\traversing.js:300:24)
at Page.collectHeadingsAndKeywordsInContent (C:\repos\markbind\markbind\packages\cli\node_modules@markbind\core\src\Page\index.js:254:8)
at Page.collectHeadingsAndKeywords (C:\repos\markbind\markbind\packages\cli\node_modules@markbind\core\src\Page\index.js:232:10)
at Page.generate (C:\repos\markbind\markbind\packages\cli\node_modules@markbind\core\src\Page\index.js:489:10), errno=-4058, syscall=open, code=ENOENT, path=C:\repos\nus-cs2103\cs2103-website-base_site\book\uml\objectDiagrams\introduction\unit-inElsewhere-asFlat.include.html

@ryoarmanda
Copy link
Contributor

ryoarmanda commented Jul 8, 2021

BTW, the precise version of the CS2103 website I'm using is https://github.com/nus-cs2103/website-base

Just to confirm, are you working on the master branch or other branches?

I linked my MarkBind to the version in this PR for this experiment but how to confirm (as there is no change in behavior)?. Perhaps you can put some extra log messages in this version to confirm that I'm using the correct version by looking at the log output?

Thanks for the suggestion, I added some changes to the PR, now we can identify whether the trial is used by looking at the logged version (should be v3.0.4-trial).

To update the trial PR branch, you need to check out to some other branch before updating it.

git checkout master
git fetch origin pull/1632/head:1632-trial
git checkout 1632-trial

Regarding the error log you provided, not sure if the trial is properly linked. The unhandled rejection error still says Error while generating undefined, pretty sure I already fixed both the error message and rejection handling in the trial PR. If there's an error during page generation, the log would have something like this now:

error: Asynchronous page callback error
error:  message=Test error, stack=Error: Test error
    at ...
error: Asynchronous generation failed
error:  message=Error while generating C:\Users\Ryo Armanda\projects\website-base\admin\appendixA-principles.md, stack=Error: Error while generating C:\Users\Ryo Armanda\projects\website-base\admin\appendixA-principles.md
    at ...

@damithc
Copy link
Contributor Author

damithc commented Jul 8, 2021

Just to confirm, are you working on the master branch or other branches?

I'm using cs2103 branch. On Windows 10.

Yes, It's possible that the new version wasn't linked properly before. There was an error from the npm link command this time that I probably didn't spot last time. So, I used npm link --force to overcome that error this time.

After linking properly (I hope), I'm getting this error for markbind serve -o.

error: Oops! It seems that you didn't have the default file index.md|mbd.

The error goes away after I unlink and go back to the production version.

@damithc
Copy link
Contributor Author

damithc commented Jul 8, 2021

BTW, i'm using this method to link https://markbind.org/devdocs/devGuide/settingUp.html#setting-up-the-dev-environment
I hope it's the correct method.

The error I get for npm link (when run inside packages/cli folder) is the following:

$ npm link
npm notice created a lockfile as package-lock.json. You should commit this file.
added 3 packages from 8 contributors and audited 854 packages in 7.24s

28 packages are looking for funding
run npm fund for details

found 4 vulnerabilities (1 moderate, 3 high)
run npm audit fix to fix them, or npm audit for details
npm ERR! code EEXIST
npm ERR! path C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\index.js
npm ERR! dest C:\Users\dcsdcr\AppData\Roaming\npm\markbind.cmd
npm ERR! EEXIST: file already exists, cmd shim 'C:\Users\dcsdcr\AppData\Roaming\npm\node_modules\markbind-cli\index.js' -> 'C:\Users\dcsdcr\AppData\Roaming\npm\markbind.cmd'
npm ERR! File exists: C:\Users\dcsdcr\AppData\Roaming\npm\markbind.cmd
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\dcsdcr\AppData\Roaming\npm-cache_logs\2021-07-08T06_30_49_061Z-debug.log

npm link --force gets rid of the above error but I wonder it that is related to the following error that I got for the subsequent markbind -o command.

error: Oops! It seems that you didn't have the default file index.md|mbd.

@ryoarmanda
Copy link
Contributor

ryoarmanda commented Jul 8, 2021

Can you try running npm run setup (the third step in the guide)? I usually just use that when checking out development code (maybe the npm link was a one-time thing I had done long ago). If I'm not wrong, it also does the linking for you. If you have done it, then it might have already linked the trial PR branch. Can you verify by running markbind (without any other arguments)? It should print the help message with the version v3.0.4-trial.

Aside: I did try to run the usual markbind serve -o in the cs2103 branch, but it turns out that it does not have the layout files to generate the landing. Have the files been migrated to v3 layout? This is on the https://github.com/nus-cs2103/website-base repo by the way (the one in your comment), if I try it on the https://github.com/nus-cs2103-AY2021S2/website (the one you initially reported) it's working fine.

@ong6
Copy link
Contributor

ong6 commented Aug 29, 2021

Turns out it has nothing to do with clicking. The the command fails on its own (without any clicking) after a while with the given error. And it seems to happen almost every time (happened 5/5 most recent tries).

Hi, I have tried to replicate this issue but I cannot seem to reproduce or get any errors? Seems to be working fine on my end.

@damithc
Copy link
Contributor Author

damithc commented Aug 30, 2021

Hi, I have tried to replicate this issue but I cannot seem to reproduce or get any errors? Seems to be working fine on my end.

Thanks for checking @ong6
Did you try with the cs2103 website? It may have to do with the site itself.
Or it could be specific to my computer.

@ong6
Copy link
Contributor

ong6 commented Aug 31, 2021

@damithc Yep, I tried it and there were no errors for me. Perhaps the error is specific to your computer?

@damithc
Copy link
Contributor Author

damithc commented Sep 1, 2021

Seems like something specific to my local setup. This is when working on https://github.com/se-edu/guides
Failed the same way 3/3 times, but different errors:

image
image

@ong6
Copy link
Contributor

ong6 commented Sep 1, 2021

Thanks for the screenshots @damithc I will look into this and see if I can replicate/ solve this issue

@ryoarmanda
Copy link
Contributor

ryoarmanda commented Sep 4, 2021

Thanks for lending a hand @ong6 ! A while back I have written one possible cause on a trial PR (see the last comment on #1632) but we're still unsure on whether that is what's happening on prof's side because we could not reproduce it. Feel free to investigate further :)

@ong6
Copy link
Contributor

ong6 commented Oct 7, 2021

No matter what I try I am unable to replicate this error and everything works fine with the latest release of markbind. However, I suspect it has something to do with Prof's node version and/or his markbind node modules.

Perhaps a few steps to fix this issue can be:

  1. update to the latest version of node. (test for error again)
  2. remove all the \node_modules files inside the root dir of markbind and then run npm run setup then npm link again. (test for error again)
  3. Try some of the solutions at this stack overflow page. Particularly the npm cache clean --force and the Permissions settings for the project folder.

Some other references:
EPERM, mkdir error

Do let me know if any of this helped!

@damithc
Copy link
Contributor Author

damithc commented Oct 11, 2021

Thanks for investigating this @ong6 , and thanks for the suggestions too.

  1. I'm using node v14.10.0
  2. I'm using the release version of MarkBind, not the dev version

I ran the npm cache clean --force as that seems the easiest thing to try.

Guess what, tried twice and couldn't reproduce the problem. Not sure what fixed it but seems to be fixed now. :-)

Closing this now. Will reopen if it crops up again.

@damithc damithc closed this as completed Oct 11, 2021
@ong6
Copy link
Contributor

ong6 commented Oct 11, 2021

@damithc Yay! Glad my investigation yielded some results! npm cache clean just clears the cache folder kept by npm. Guess something in your previous cache was causing errors. I think we won't be seeing this issue be opened again anytime soon 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants