执行jest的时候报错:TypeError: _gracefulFs(...).realpathSync.native is not a function解决方案:
[email protected] 不支持node8, 使用
[email protected]
接收参数:
path
路径
cache 可选,一个文字的映射路径可用于强制一个特定的路径解决或避免额外的fs.stat需要知道真正的路径对象。
代码如下:
var fs = require(‘fs’);
// 点号表示当前文件所在路径
查看gitbook版本gitbook -V报错:
/usr/local/lib/node_modules/gitbook-cli/node_modules/npm/node_modules/
gr
ace
ful-fs/polyfills.js:287
if (cb) cb.apply(this, arguments)
TypeError
: cb.apply is not a
function
at /usr/local/lib/node_modules
1、fs.rename(
path
1,
path
2, [callback]) 和 fs.rename
Sync
(
path
1,
path
2)
运行代码如下,就可以将test2.js改名为test3.js
var fs = require('fs')
fs.rename('./test2.js', './test3.js',
function
(err) {
if (err) throw er
在electron的渲染进程中导包会发生
TypeError
: fs.exists
Sync
is not a
function
node_modules/electron/index.js:6
4 | var
path
File =
path
.join(__dirname, '
path
.txt')
> 6 | if (fs.exists
Sync
(
path
Fi...
最近electron变成了12.0,在渲染进程中 使用electron模块和electron-store模块出错,我的解决办法是首先将electron回退到 上个版本:cnpm install
[email protected],
然后 在主进程中的主窗口设置:
mainWindow = new BrowserWindow({
width:1440,
height:765,
webPreferences:{
nodeInte
gr
ati
23 import { app } from 'electron';
55 export default class
real
NetMeeting extends Component {
控制台提示是:报错源于第55行。我算是看明白了,合着即便是第23行import引起的错误,提示的时候也偏偏提示是,55行,组件声明时的错。害得我以为真的是55行有什么错误。定
最近想用 Qt 写一个界面在 C++ 下调用 Pytorch 模型,整个环境配置下来遇到了不少问题,因此记录一下。
1. 下载安装相关文件
由于我的开发环境是 Win10,因此需要下载的东西挺多的,IDE 用的 Visual Studio 2019,在 这里 下载社区版,安装的时候可以选择需要的编译器,我装的是 MSVC v142,cmake 也可以在 vs2019 里直接装,或者自己下载单独的 cmake 安装。
在 cmd 里输入 cmake 以确保能够正常使用,如果不行,需要把 cmake 的 bin
以前就觉得Nodejs的MooTools库很奇怪,因为用他的时候,不需要把require的返回值保存起来,今天实在憋不住,就研究了下,对NodeJs的require机制又有了几分深刻的理解。
MooTools库的“奇怪”用法:
require('mootools');
var QueryCommand = new Class({
initialize: fun...
TypeError
: fs.exists
Sync
is not a
function
在渲染进程中使用remote模块出现上面错误,百度后发现,只要在require前面加上window就行,应该是他们把electron绑定在window对象上面了
const {BrowserWindow} = window.require(‘electron’).remote;
经过一系列查找,也看了很多国内外的解决方案,都不太理想,要么是预加载文件,提前保存对象;要么是增加window.require;
终于在同事的提醒下,将@vue/cli的版本降低为4.0.5后,渲染进程使用require(‘electron’)完美获取到相应对象。
vue/cli卸载命令
npm uninstall -g @vue/cli
vue/cli安装老版本命令
npm install -g @vue/
[email protected]
我原来的版本是4.5.x
整个electron-vue的整合步骤
1.使用v