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

搭建easymock后,启动预览接口时,报错:Uncaught ReferenceError: hljs is not defined #448

Open
xieshengnan opened this issue Mar 30, 2021 · 4 comments

Comments

@xieshengnan
Copy link

OS:Linux version 2.6.32 / Browser Version

Node.js :v8.10.0 / MongoDB :3.6.13

Steps to reproduce

  1. linux部署服务
  2. windows浏览器输入链接访问
  3. 接口中点击“预览”时,

What is Expected?

界面可以正常返回接口mock出来的数据
image

What is actually happening?

报错 “Uncaught ReferenceError: hljs is not defined“
image

@xieshengnan xieshengnan changed the title Uncaught ReferenceError: hljs is not defined 搭建easymock后,启动预览接口时,报错:Uncaught ReferenceError: hljs is not defined Mar 30, 2021
@SilvaQ
Copy link

SilvaQ commented Apr 20, 2021

出现这个问题主要原因是 restc 包更新了,现在restc使用的所有路径前面都有shadow这个字样,具体的请看文件:
restc首页文件源码

那么临时解决方案: 你进入你的容器 吧node_modules下的restc的faas下的index.html中的所有路径按照restc最新路径替换,然后偶重新编译
指南:

  • sudo docker exec -it -u root 容器名 /bin/bash
  • apt-get update
  • apt-get install vim -y
  • vim node_modules下的faas/index.html 替换路径为正确的url
  • npm build
  • 推出容器后重启容器

如果想从根解决 你得更新restc的版本后重新编译easymock生成你的容器。

祝好!

@Symous
Copy link

Symous commented May 5, 2021

这坑也太多了,经过头铁找资料尝试,可以找到node_modules/restc/faas/index.html,然后注释掉

<script src="https://github.elemecdn.com/highlightjs/cdn-release/9.8.0/build/highlight.min.js"></script>

在下面粘贴上

<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.8.0/highlight.min.js"></script>
 <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.8.0/languages/go.min.js"></script>

重新启动即可,亲测好用。

@ideacco
Copy link

ideacco commented May 8, 2021

出现这个问题主要原因是 restc 包更新了,现在restc使用的所有路径前面都有shadow这个字样,具体的请看文件:
restc首页文件源码

那么临时解决方案: 你进入你的容器 吧node_modules下的restc的faas下的index.html中的所有路径按照restc最新路径替换,然后偶重新编译
指南:

  • sudo docker exec -it -u root 容器名 /bin/bash
  • apt-get update
  • apt-get install vim -y
  • vim node_modules下的faas/index.html 替换路径为正确的url
  • npm build
  • 推出容器后重启容器

如果想从根解决 你得更新restc的版本后重新编译easymock生成你的容器。

祝好!

非常感谢,解决了我的问题!

@bmphjhu906
Copy link

不用辣么麻烦,更新一下package.json中的restc包:"restc": "^0.3.0",然后删除node_modules,重新 npm install

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

No branches or pull requests

5 participants