Markdown-preview-enhanced: Uncaught EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an al...

Created on 4 Mar 2017  ·  10Comments  ·  Source: shd101wyy/markdown-preview-enhanced

[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.14.4 x64
Electron: 1.3.13
OS: Unknown Windows version
Thrown From: markdown-preview-enhanced package 0.10.1

Stack Trace

Uncaught EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self'".

At C:\Users\Lyn\.atom\packages\markdown-preview-enhanced-master\node_modules\ajv\lib\compile\index.js:171

EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self'".

    at Ajv.localCompile (/packages/markdown-preview-enhanced-master/node_modules/ajv/lib/compile/index.js:139:26)
    at Ajv.resolve (/packages/markdown-preview-enhanced-master/node_modules/ajv/lib/compile/resolve.js:53:19)
    at Object.resolveRef (/packages/markdown-preview-enhanced-master/node_modules/ajv/lib/compile/index.js:210:21)
    at /packages/markdown-preview-enhanced-master/node_modules/ajv/lib/dotjs/ref.js:22:22)
    at /packages/markdown-preview-enhanced-master/node_modules/ajv/lib/dotjs/validate.js:156:37)
    at /packages/markdown-preview-enhanced-master/node_modules/ajv/lib/dotjs/properties.js:199:26)
    at generate_validate (/packages/markdown-preview-enhanced-master/node_modules/ajv/lib/dotjs/validate.js:229:37)
    at localCompile (/packages/markdown-preview-enhanced-master/node_modules/ajv/lib/compile/index.js:99:22)
    at Ajv.compile (/packages/markdown-preview-enhanced-master/node_modules/ajv/lib/compile/index.js:67:13)
    at _compile (/packages/markdown-preview-enhanced-master/node_modules/ajv/lib/ajv.js:328:29)
    at getSchema (/packages/markdown-preview-enhanced-master/node_modules/ajv/lib/ajv.js:192:51)
    at validate (/packages/markdown-preview-enhanced-master/node_modules/ajv/lib/ajv.js:91:11)
    at validateSchema (/packages/markdown-preview-enhanced-master/node_modules/ajv/lib/ajv.js:162:19)
    at _addSchema (/packages/markdown-preview-enhanced-master/node_modules/ajv/lib/ajv.js:288:7)
    at addSchema (/packages/markdown-preview-enhanced-master/node_modules/ajv/lib/ajv.js:133:26)
    at addInitialSchemas (/packages/markdown-preview-enhanced-master/node_modules/ajv/lib/ajv.js:396:39)
    at /packages/markdown-preview-enhanced-master/node_modules/ajv/lib/ajv.js:78:3)
    at /packages/markdown-preview-enhanced-master/node_modules/request/node_modules/har-validator/lib/node4/promise.js:43:11)
    at Module._compile (/app.asar/src/native-compile-cache.js:109:30)
    at /app.asar/src/compile-cache.js:216:21)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.require (module.js:483:17)
    at require (/app.asar/src/native-compile-cache.js:50:27)
    at /packages/markdown-preview-enhanced-master/node_modules/request/lib/har.js:5:16)
    at Module._compile (/app.asar/src/native-compile-cache.js:109:30)
    at /app.asar/src/compile-cache.js:216:21)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)

Commands

     -0:31.2.0 markdown-preview-enhanced:toggle (input.hidden-input)

Non-Core Packages

markdown-preview-enhanced 0.10.1 

Most helpful comment

i don't know how to do this ,you can change it directly

All 10 comments

Hi @860git ,

How did you trigger this issue?
Could you please send me your markdown file?

Thanks

that has nothing with the markdown file
my system is win7 64bit
it's the first time i install "markdown-preview-enhanced"
this is my steps to install "markdown-preview-enhanced":

  1. download it from github
  2. update nodejs(now is v6.10.0)
  3. extract "markdown-preview-enhanced-master.zip" to "C:Userslol.atompackages"
  4. cd C:\Users\lol\.atom\packages\markdown-preview-enhanced-master
  5. npm install
  6. open atom
  7. open any markdown file and then _Packages->markdown-preview-enhanced->Toggle_
    then the error occur on the right

Huh that's weird. This issue seems to be related to request package.
Could you please help me try downgrading request to version 2.76.0. (Because I didn't meet this issue on my Mac)
You can modify the package.json file and run npm install again.
Thank you very much

@shd101wyy i have solved it by following your guide,thank you!

@860git Thank you. I will release a new version as soon as possible. :-)
You can submit pull request if you want, or I can change it directly.

i don't know how to do this ,you can change it directly

Done. Cheers

我从0.10.1升级到0.10.3以后,preview无法正常显示了。
后来用下面这个命令降级后,出现了这个错误。
请问有方法解决吗?
apm install [email protected]

我没有用下面这个方法安装,不太清楚怎么降级request。

You can modify the package.json file and run npm install again.

另外0.10.3一开始升级后preview无法显示了,我忘了截图,抱歉。
后来发现降级0.10.1后也无法用以后再次升级0.10.3后出现了下面这个一样的问题。

306

@coolboy0961 修好了,谢谢~

@shd101wyy
最新版好用了,非常感谢!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

liuwa666 picture liuwa666  ·  5Comments

abhayghatpande picture abhayghatpande  ·  5Comments

adamaltmejd picture adamaltmejd  ·  5Comments

siriuscc picture siriuscc  ·  3Comments

ckdanny picture ckdanny  ·  5Comments