踩坑记(代码、工具等使用问题)

一、前言

在工作中或者新的框架等都会踩坑,有时同一个还不只一次,感觉有必要记录一下。

这里分类记录下。

二、node 包管理

现在前端框架大行其道。在使用框架的同时需要管理各种包,这里面经常会在 npm install 时出现各种问题。在这里记录下。

1、EPERM: operation not permitted

具体信息:Error: EPERM: operation not permitted, unlink......

解决办法:1、删除 node_modules 文件;2、清理缓存(npm cache clean --force);3、重新 install

2、check python

具体信息:check python checking for Python executable "python2" in the PATH

解决办法:(缺少python2.7支持 可快速使用以下语句完成安装)

先删除 node_module 文件夹,执行以下语句就可以

1、npm cache clean --force
2、npm install --global --production windows-build-tools
3、npm install node-sass@4.12.0 -S (也可以不带版本号安装最新,tyarn add node-sass -S)
4、npm rebuild node-sass (如果出现 no such flle or directory,scandir '../node_modules/node-sass/vendor' 这个错误时执行)

三、VS Code

1、powershell

已经安装了 cnpm、yarn 等但是不可用。

解决方法:

1)、以管理员运行 powershell

2)、输入指令:set-ExecutionPolicy RemoteSigned

3)、更改执行策略:A

2、运行 TS 文件

在安装了 code run 插件后,可以直接运行 js 文件,但是 ts 文件一直有问题

是需要再安装其他包:

1)、安装 “Code Runner” 插件

2)、全局安装 ts-node 包:npm install ts-node -g

四、浏览器

1、Chrome 全面崩溃

打开任何网友都崩溃,包括“设置”、“书签等”

解决方法:

1)、Win + R 打开运行对话框,输入 regedit 打开注册表

2)、找到 HKEY_LOCAL_MACHINE SOFTWARE Policies Google Chrome (如果没有 GoogleChrome 文件夹,可以新建)

3)、在右侧点击新建 DWORD(32位) (名称输入:RendererCodeIntegrityEnabled,值 0)

4)、重启 Chrome 即可

原文地址:https://www.cnblogs.com/zhurong/p/12811838.html