Failed to build project while follow the master branch readme
latest master
I follow the readme:
$ git clone https://github.com/{your-personal-repo}/tui.editor.git
$ npm install
$ cd apps/editor
$ npm install
But when i run
npm run serve
i have the following error:
ERROR in ./src/js/convertor.js
Module not found: Error: Can't resolve '@toast-ui/to-mark' in '/xxxx/tui.editor/apps/editor/src/js'
@ ./src/js/convertor.js 5:0-39 164:19-25
@ ./src/js/editor.js
@ ./src/js/index.js
ERROR in ./src/js/toMarkRenderer.js
Module not found: Error: Can't resolve '@toast-ui/to-mark' in '/xxxx/tui.editor/apps/editor/src/js'
@ ./src/js/toMarkRenderer.js 1:0-39 42:15-21 42:39-45
@ ./src/js/editor.js
@ ./src/js/index.js
ERROR in ./src/js/editor.js
Module not found: Error: Can't resolve '@toast-ui/toastmark' in '/xxxx/tui.editor/apps/editor/src/js'
@ ./src/js/editor.js 75:0-48 182:25-34
@ ./src/js/index.js
ERROR in ./src/js/markdownToHTML.js
Module not found: Error: Can't resolve '@toast-ui/toastmark' in '/xxxx/tui.editor/apps/editor/src/js'
@ ./src/js/markdownToHTML.js 1:0-63 6:19-25 10:19-35
@ ./src/js/editor.js
@ ./src/js/index.js
ERROR in ./src/js/mdPreview.js
Module not found: Error: Can't resolve '@toast-ui/toastmark' in '/xxxx/tui.editor/apps/editor/src/js'
@ ./src/js/mdPreview.js 11:0-55 40:23-39
@ ./src/js/editor.js
@ ./src/js/index.js
ERROR in ./src/js/convertor.js
Module not found: Error: Can't resolve '@toast-ui/toastmark' in '/xxxx/tui.editor/apps/editor/src/js'
@ ./src/js/convertor.js 6:0-63 36:24-30 40:22-38
@ ./src/js/editor.js
@ ./src/js/index.js
(xxxx is my local folder path)
Any extra step needed to build the project?
@kelvinkoko This error is because the bundle files of the libraries used in the editor are not created. So you have to install npm on each library, run the build, and build the Editor. Let me explain the process in more detail.
First, you need to go to each library folder in the Editor's root(tui.editorfolder). In the example, take toastmark as an example.
- tui.editor/
- libs/
- squire/ ...
- to-mark/ ...
- toastmark/ ...
```sh
$ cd libs/toastmark && npm install
You need to build the bundle file after installing npm. Each library has a different build script, so in this case you need to run the script in [`package.json` at the root](https://github.com/nhn/tui.editor/blob/b5236451ca54bf8d7e60327b08131c3189321c40/package.json#L11-L24).
```sh
$ cd ../../ && npm run build:toastmark
This will create toastmark's build file and do the same for squire and to-mark.
I couldn't consider missing this process. This should be added to the documentation. And now I think it would be convenient to combine npm install script with the build script. I'll improve this later. 🤔
Thanks for reporting!
@seonim-ryu Got it, thank you for your detail instruction!~ I will try it.
Yes, it will be great if having a single build command :)
I too found that the instructions in README.md were not working ...
https://github.com/nhn/tui.editor/blob/dba0438df7bb82265591fee3c317625198ee7daa/package.json#L1-L4
I added a version number (e.g. "version": "0.1.0",) and NPM was still having issues ... so I tried yarn and had some more success.
yarn/npm run test in the apps.editor directory resulted in an error from karma that ChromeHeadless was unavailable.At this point, I'm not sure what's going on - but I'm thinking there are issues with the layout of the project... specifically, some things to consider:
npm audit resulted in many vulnerabilities:added 229 packages from 221 contributors and audited 229 packages in 6.542s found 15 vulnerabilities (7 low, 4 moderate, 2 high, 2 critical)added 1009 packages from 1510 contributors and audited 1080 packages in 30.005s found 38363 vulnerabilities (38362 low, 1 high)added 1419 packages from 1267 contributors and audited 1490 packages in 43.311s found 121 vulnerabilities (56 low, 25 moderate, 37 high, 3 critical)added 4690 packages from 2607 contributors and audited 2039 packages in 148.597s found 62 vulnerabilities (11 low, 25 moderate, 24 high, 2 critical)Now, I have not looked at the particular vulnerabilities and their impacts (the impact may very well be zero) -- and it's highly likely that, due to the way node/npm dependencies work, the vulnerabilities are somewhere way deep in the dependency graph/tree. Still, however, it's a concern.
Also, unless I'm misreading something, the dependencies seem WAY out of date: try running an npm outdated --depth=1 in the apps/editor folder... It gets even more interesting at depth levels 2, 3, and 4.
@seonim-ryu I would suggest:
Consider setting up some form of CI (Travis/pick one.) ... This will, among other things:
master branch should be 100% working 100% of the time. (e.g. if a proposed commit to master doesn't build/work/past tests, it doesn't break the codebase.) Really consider some of the dependencies and the structure... The whole NPM/Yarn ecosystem revolves around the idea of being able to download a repo, run npm/yarn install and then go... From the project root.
Double check the use of Bower in some of the dependencies - I'm 99% sure it's considered EOL.
Just some thoughts :)
Most helpful comment
@kelvinkoko This error is because the bundle files of the libraries used in the editor are not created. So you have to install npm on each library, run the build, and build the Editor. Let me explain the process in more detail.
First, you need to go to each library folder in the Editor's root(
tui.editorfolder). In the example, taketoastmarkas an example.```sh
$ cd libs/toastmark && npm install
This will create
toastmark's build file and do the same forsquireandto-mark.I couldn't consider missing this process. This should be added to the documentation. And now I think it would be convenient to combine npm install script with the build script. I'll improve this later. 🤔
Thanks for reporting!