1. npm install时报错
-
Unexpected end of JSON input while parsing near
解决方法
[zerone@localhost ~]# npm cache clean --force
-
Windows运行
npm install
时报Error: spawn cmd ENOENT
解决方法
- 在环境变量Path中添加
%SystemRoot%\system32;
- 重启电脑
- 在环境变量Path中添加
2. Linux环境Webstorm中markdown预览中文乱码
解决方法
zerone@zerone-PC:~/Desktop$ sudo aptitude search uming
[sudo] zerone 的密码:
p fonts-arphic-uming - "AR PL UMing" Chinese Unicode TrueType font
v fonts-arphic-uming:i386 -
zerone@zerone-PC:~/Desktop$ sudo aptitude install fonts-arphic-uming
zerone@zerone-PC:~/Desktop$ sudo aptitude search uming
i fonts-arphic-uming - "AR PL UMing" Chinese Unicode TrueType font
v fonts-arphic-uming:i386 -
zerone@zerone-PC:~/Desktop$
3. Chrome网页截图
-
打开开发者工具
- 使用
Ctrl+Shift+i
或F12
快捷键打开 - 用鼠标右键检查打开
- 使用
-
选择Elements
-
使用
Ctrl+Shift+p
打开命令行,输入screen
命令,如图所示:[外链图片转存失败(img-HJF7VvXX-1565919327129)(…/images/0.png)]
4. npx
命令
npm版本 > 5.2.0
npx
是一个旨在提升npm包的使用体验——就像npm极大地提升了我们安装和管理包依赖的体验,npx让npm包中的命令行工具和其他可执行文件在使用上变得更加简单。它极大地简化了我们之前使用纯粹的npm时所需要的大量步骤。
当你执行
npx <command>
而<command>
并不在你的系统变量路径**$PATH**中,npx
会自动为你从npm上下载安装叫这个名字的包,并且执行它。当做完这些事情后,已安装的包不会出现在你的全局安装中,所以不用担心长期使用所带来的全局污染。
5. 前端bug——无法输入中文
监听
input
事件导致中文无法输入或未选择文字时触发事件
解决方法
let typing = false, node = documment.querySelector('input.test');
node.addEventListener('compositionstart',function(){
typing = true;
});
node.addEventListener('compositionend',function(){
typing = false;
});
node.addEventListener('input',function(e){
console.log(this.value)
});