atom
是github
出的一款产品,提供了许多可供选择的插件,用来编辑文档是挺方便的。
笔者也是最近在使用这款软件。其中安装某些软件时出现一些问题,如:文本格式转换插件markdown-themeable-pdf
,markdown-pdf
.下面具体详述报错及其解决办法。
一些报错
Markdown-pdf: Error. Check console for more information.
AssertionError: html-pdf: Failed to load PhantomJS module
错误分析
根据控制台报错提示,可以看出这是未能加载PhantomJS
模块。大胆猜想,可能是因为墙的原因吧!
既然知道了原因,这就好办了。
问题解决
- 根据报错, 我们首先尝试去安装所需模块
npm install phantomjs-prebuilt
,两分钟过后,
笔者的界面任然在加载该模块,如下:
C:\Users\***>npm install phantomjs-prebuilt
npm WARN deprecated phantomjs-prebuilt@2.1.16: this package is now deprecated
> phantomjs-prebuilt@2.1.16 install C:\Users\dell\node_modules\phantomjs-prebuilt
> node install.js
PhantomJS not found on PATH
Downloading https://github.com/Medium/phantomjs/releases/download/v2.1.1/phantomjs-2.1.1-windows.zip
Saving to C:\Users\dell\AppData\Local\Temp\phantomjs\phantomjs-2.1.1-windows.zip
Receiving...
[=---------------------------------------] 3%终止批处理操作吗(Y/N)?
速度极慢,于是手动下载配置。
-
去官网下载
安装包
之后将其根据自身目录放置(如我的:C:\Users***\AppData\Local\Temp\phantomjs)。不需要解压。 -
再次执行npm install phantomjs-prebuilt
npm WARN deprecated phantomjs-prebuilt@2.1.16: this package is now deprecated
> phantomjs-prebuilt@2.1.16 install C:\Users\dell\node_modules\phantomjs-prebuilt
> node install.js
PhantomJS not found on PATH
Download already available at C:\Users\dell\AppData\Local\Temp\phantomjs\phantomjs-2.1.1-windows.zip
Verified checksum of previously downloaded file
Extracting zip contents
Removing C:\Users\dell\node_modules\phantomjs-prebuilt\lib\phantom
Copying extracted folder C:\Users\dell\AppData\Local\Temp\phantomjs\phantomjs-2.1.1-windows.zip-extract-1569844012125\phantomjs-2.1.1-windows -> C:\Users\dell\node_modules\phantomjs-prebuilt\lib\phantom
Writing location.js file
Done. Phantomjs binary available at C:\Users\dell\node_modules\phantomjs-prebuilt\lib\phantom\bin\phantomjs.exe
npm WARN saveError ENOENT: no such file or directory, open 'C:\Users\dell\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\dell\package.json'
npm WARN dell No description
npm WARN dell No repository field.
npm WARN dell No README data
npm WARN dell No license field.
+ phantomjs-prebuilt@2.1.16
updated 1 package in 5.051s
这时,说明已经安装成功,重启atom
,右键导出pdf
。
笔者测试时,在md
文档里插入图片失败。ctrl+v
只出现一空行,未能找到解决办法。哪位兄弟有好的方法了,欢迎留言。
atom 推荐使用插件
谈风月之余谈技术