1. After constructing easyMock, click the preview interface and an error is reported
query:182 Uncaught ReferenceError: hljs is not defined
at HighlightBlock.update (query:182:9)
at RequestView.update (query:222:20)
at ResultView.update (query:392:26)
at Main.sendRequest (query:1019:25)
at Main.init (query:994:16)
at umd.js:1:2308
at r (umd.js:1:916)
at new s (umd.js:1:2274)
at new Main (query:979:5)
at Frame.init (query:1063:9)
update @ query:182
update @ query:222
update @ query:392
sendRequest @ query:1019
init @ query:994
(anonymous) @ umd.js:1
r @ umd.js:1
s @ umd.js:1
Main @ query:979
init @ query:1063
(anonymous) @ umd.js:1
r @ umd.js:1
s @ umd.js:1
Frame @ query:1059
(anonymous) @ query:1096
material.css:1 Failed to load resource: the server responded with a status of 404 ()
codemirror.css:1 Failed to load resource: the server responded with a status of 404(a)default.min.css:1 Failed to load resource: the server responded with a status of 404(a)Copy the code
2. Go to the web container and findnode_modules/restc/faas/index.html
The file will be belowhighlightjs
replace
< script SRC = "https://github.elemecdn.com/highlightjs/cdn-release/9.8.0/build/highlight.min.js" > < / script >Copy the code
Replace with:
< script SRC = "/ / cdnjs.cloudflare.com/ajax/libs/highlight.js/9.8.0/highlight.min.js" > < / script >Copy the code
3. How to replacehighlightjs
file
3.1 Enter the web container, the container name of my Web is03_web_1
#Replace 03_web_1 with the container name for your Web, which can be viewed via Docker PS
docker exec -it 03_web_1 bash
Copy the code
3.2 the use ofvim
or vi
Edit in the Web containernode_modules/restc/faas/index.html
File, the file inhighlightjs
replace
#Edit the file
vim node_modules/restc/faas/index.html
#What needs to be replaced< script SRC = "https://github.elemecdn.com/highlightjs/cdn-release/9.8.0/build/highlight.min.js" > < / script >#Replace with< script SRC = "/ / cdnjs.cloudflare.com/ajax/libs/highlight.js/9.8.0/highlight.min.js" > < / script >Copy the code
3.3 If your Web container does notvim
oor vi
, can be accessed throughdocker cp
将 node_modules/restc/faas/index.html
The file is copied and edited
3.3.1 Copying files to your host
# docker cp ${your Web container name}:/home/easy-mock/easy-mock/node_modules/restc/faas/index.html ${your host's file directory}
docker cp 03_web_1:/home/easy-mock/easy-mock/node_modules/restc/faas/index.html /mnt/d/workspace
Copy the code
3.3.2 rainfall distribution on 10-12 editornode_modules/restc/faas/index.html
File contents, replacehighlight
, the content after replacement is as follows:
3.3.3 Will be editednode_modules/restc/faas/index.html
The files are then copied into the container
# docker cp ${your host directory (the path to which the files were copied in 3.3.1)}/index.html /home/easy-mock/easy-mock/node_modules/restc/faas/
docker cp /mnt/d/workspace/index.html 03_web_1:/home/easy-mock/easy-mock/node_modules/restc/faas/
Copy the code
3.3.3 Verifying the web containernode_modules/restc/faas/index.html
Whether editing succeeded
#Go into the Web container and replace 03_web_1 with the container name for your Web
docker exec -it 03_web_1 bash
#Verify node_modules/restc/faas/index. The contents of the HTML file is the latest, refer to below
cat node_modules/restc/faas/index.html | grep highlight
Copy the code
4. Restart the Web container
#Replace 03_web_1 with the container name for your Web
docker restart 03_web_1
Copy the code