记录下重装系统后重设项目环境遇到的坑

系统重装了好久没碰之前写的vue项目了。这里随手记录下重设系统环境所遇到的坑以及相应的解决方法。


错误概览

  1. node.js未重新配置
  2. Git未重新配置
  3. Git与Github未重新关联
  4. node-gyp的python运行环境缺失
  5. \node-sass\vender 目录缺失

环境/工具清单

  • Win7
  • IntelliJ IDEA
  • node.js (v8.9.3)
  • npm (5.8.0)
  • python (v3.6.5)
     

排雷现场

帐号提示激活

打开IJ得重新激活账户。之前的配置信息也全部丢失了,得重新配置;

运行项目提示没有node interpreter

在setting里面重新指向了原nodejs位置并手动添加该位置到$PATH中。
问题依旧存在。无奈之下重装nodejs,done。

 

npm install 后run了一下,出现如下提示:
These dependencies were not found:
* babel-runtime/regenerator in ./src/store/mutation.js, ./src/config/mUtils.js and 20 other...
To install them, you can run: npm install --save babel-....

按照错误信息输入如下指令试着安装:

npm install --save babel-runtime/regenerator

出现如下错误:

npm ERR! code ENOGIT
npm ERR! Error while executing:
npm ERR! undefined ls-remote -h -t ssh://git@github.com/babel-runtime/regenerator.git
npm ERR! No git binary found in $PATH
npm ERR! Failed using git.
npm ERR! Please check if you have git installed and in your PATH.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Emiya\AppData\Roaming\npm-cache\_logs\2018-04-15T10_42_46_217Z-debug.log

在setting里面重新指向../../Git/bin,并配置到$PATH,在Setting里test提示如下,

这里写图片描述

然而——
这里写图片描述

扫描二维码关注公众号,回复: 1587386 查看本文章

这就郁闷了,无奈,重装,这下cmd里输入指令就能找到了。然而install的时候npm依然报同样的错误。试试重启再执行一下看看——

D:\project\Web\KDB>npm install --save babel-runtime/regenerator
npm ERR! Error while executing:
npm ERR! E:\Code\Git\cmd\git.EXE ls-remote -h -t ssh://git@github.com/babel-runtime/regenerator.git
npm ERR! Host key verification failed.
npm ERR! fatal: Could not read from remote repository.
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
npm ERR! exited with error code: 128

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Emiya\AppData\Roaming\npm-cache\_logs\2018-04-15T11_58_08_825Z-debug.log

 
很好,换了个错误了。看到ssh信息,突然想到自己安装的git还没与github绑定SSH。打开gitBash输入指令指定 RSA 算法生成密钥:

ssh-keygen -t rsa

 
在github添加新的ssh键,上将生成文件id_rsa.pub的内容复制进去。在gitBash里输入指令测试配置情况:

ssh -T git@github.com

 
配置成功,然而问题依旧存在。
无法,重新clone了一下github上的项目,npm install后报错信息如下:

gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (D:\project\git\KDB\node_modules\node-gyp\lib\configure.js:483:19)
gyp ERR! stack     at PythonFinder.<anonymous> (D:\project\git\KDB\node_modules\node-gyp\lib\configure.js:508:16)
gyp ERR! stack     at D:\project\git\KDB\node_modules\graceful-fs\polyfills.js:284:29

 
看来模块node-gyp需要python环境,吓得我赶紧下了python3并配置到环境变量。npm install, npm run dev, 然后就——

这里写图片描述

成了。。。

隔了一段时间,打开项目npm run dev,然后又出问题了。一些乱七八糟的错误提示,也忘了记录,试着输入如下指令:

npm cache verify

重新运行项目,这次换了错误:

Error: ENOENT: no such file or directory, scandir '{PATH}\node-sass\vendor'

键入指令:

npm rebuild node-sass

然后出现了如下提示:

MSBUILD : error MSB3428: 未能加载 Visual C++ 组件“VCBuild.exe”。
要解决此问题:
1) 安装 .NET Framework 2.0 SDK;
2) 安装 Microsoft Visual Studio 20053) 如果将该组件安装到了其他位置,请将其位置添加到系统路径中。 

这个错误提示可以说是real清楚了。不过我去下.NET Framework 2.0 SDK安装时系统提示已经安装过了。然后我再试rebuild指令就没报错了。


THINK

为什么执行npm installi指令需要将git绑定到github上?

猜你喜欢

转载自blog.csdn.net/qq_29977681/article/details/79951712
今日推荐