yoowinsu / blog

issues blog
17 stars 3 forks source link

Git 命令行出错汇总 #65

Open yoowinsu opened 6 years ago

yoowinsu commented 6 years ago

Git 运行命令行时总会碰到出错的情况,有时候看到非常常见的错误还能解决,也有时候网上搜到一些答案,并没有深究,下次在遇到同样的运行出错还是会不知道怎么办,于是就有了把错误汇总以及碰到错时应该如何更好的处理。

找错首先看报错提示: 1.提示中warning是警告,并没有报错,不是出错的原因; 2.Err是报错,应该看Err后面是什么错误

$ hexo d
(node:15716) [DEP0061] DeprecationWarning: fs.SyncWriteStream is deprecated.
INFO  Deploying: git
INFO  Clearing .deploy_git folder...
INFO  Copying files from public folder...
INFO  Copying files from extend dirs...
warning: CRLF will be replaced by LF in README.MDOWN.
The file will have its original line endings in your working directory.
warning: CRLF will be replaced by LF in robot.txt.
The file will have its original line endings in your working directory.
On branch master
nothing to commit, working directory clean
bash: /dev/tty: No such device or address
error: failed to execute prompt script (exit code 1)
fatal: could not read Username for 'https://github.com': Invalid argument
FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io/docs/troubleshooting.html
Error: bash: /dev/tty: No such device or address
error: failed to execute prompt script (exit code 1)
fatal: could not read Username for 'https://github.com': Invalid argument

    at ChildProcess.<anonymous> (D:\hexo\node_modules\hexo-util\lib\spawn.js:37:17)
    at emitTwo (events.js:125:13)
    at ChildProcess.emit (events.js:213:7)
    at ChildProcess.cp.emit (D:\hexo\node_modules\cross-spawn\lib\enoent.js:40:29)
    at maybeClose (internal/child_process.js:927:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
FATAL bash: /dev/tty: No such device or address
error: failed to execute prompt script (exit code 1)
fatal: could not read Username for 'https://github.com': Invalid argument

Error: bash: /dev/tty: No such device or address
error: failed to execute prompt script (exit code 1)
fatal: could not read Username for 'https://github.com': Invalid argument

    at ChildProcess.<anonymous> (D:\hexo\node_modules\hexo-util\lib\spawn.js:37:17)
    at emitTwo (events.js:125:13)
    at ChildProcess.emit (events.js:213:7)
    at ChildProcess.cp.emit (D:\hexo\node_modules\cross-spawn\lib\enoent.js:40:29)
    at maybeClose (internal/child_process.js:927:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)

npm install之后报错

$ npm i
npm ERR! Unexpected token < in JSON at position 346215

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\suyin\AppData\Roaming\npm-cache\_logs\2017-12-18T15_04_31_743Z-debug.log

删除node_modules文件夹和package-lock.json文件之后重新npm install

vux提示vux-loader 配置有问题,会导致打包过大,请升级到最新版本 vux-loader的问题

[Vue warn]: Property or method "$t" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.

[Vue warn]: Error in render: "TypeError: _vm.$t is not a function"

TypeError: _vm.$t is not a function
    at Proxy.render (eval at ./node_modules/vue-loader/lib/template-compiler/index.js?{"id":"data-v-7a5a5a4a","hasScoped":false,"transformToRequire":{"video":["src","poster"],"source":"src","img":"src","image":"xlink:href"},"buble":{"transforms":{}}}!./node_modules/vue-loader/lib/selector.js?type=template&index=0&bustCache!./node_modules/vux/src/components/alert/index.vue

[VUX warn] 抱歉,clocker 组件需要升级 vux-loader 到最新版本才能正常使用

index.js?34fc:3 VUX: 如果你看到这一行,说明 vux-loader 配置有问题或者代码书写规范的原因导致无法解析成按需引入组件,会导致打包体积过大。请升级到最新版本 vux-loader,建议开启 eslint(standard)。

解决办法: 按需引入组件

import Picker from 'vux/src/components/picker/index.vue';

components: { Picker }

Vue中 Error in render: "TypeError: Cannot read property 'replace' of null"报错

是因为调用replace的对象是null,而非字符串,应该修改默认值,或者用过滤器执行改为字符串

npm install之后报错

$ npm i
npm WARN tar ENOENT: no such file or directory, open 'D:\0000000000\jiliya\node_modules\.staging\sou                                                                                            rce-map-fa92b891\lib\array-set.js'
npm WARN tar ENOENT: no such file or directory, open 'D:\0000000000\jiliya\node_modules\.staging\sou                                                                                            rce-map-7bdbe7cc\lib\array-set.js'
npm WARN tar ENOENT: no such file or directory, open 'D:\0000000000\jiliya\node_modules\.staging\bab                                                                                            el-preset-stage-2-d8c0a11c\lib\index.js'
npm WARN tar ENOENT: no such file or directory, open 'D:\0000000000\jiliya\node_modules\.staging\sou                                                                                            rce-map-fa92b891\lib\base64-vlq.js'
npm WARN tar ENOENT: no such file or directory, open 'D:\0000000000\jiliya\node_modules\.staging\sou                                                                                            rce-map-7bdbe7cc\lib\base64-vlq.js'
npm WARN tar ENOENT: no such file or directory, open 'D:\0000000000\jiliya\node_modules\.staging\sou                                                                                            rce-map-fa92b891\lib\base64.js'
npm WARN tar ENOENT: no such file or directory, open 'D:\0000000000\jiliya\node_modules\.staging\sou                                                                                            rce-map-7bdbe7cc\lib\base64.js'
npm WARN tar ENOENT: no such file or directory, open 'D:\0000000000\jiliya\node_modules\.staging\sou                                                                                            rce-map-fa92b891\lib\binary-search.js'
npm WARN tar ENOENT: no such file or directory, open 'D:\0000000000\jiliya\node_modules\.staging\sou                                                                                            rce-map-7bdbe7cc\lib\binary-search.js'
npm WARN tar ENOENT: no such file or directory, open 'D:\0000000000\jiliya\node_modules\.staging\sou                                                                                            rce-map-fa92b891\lib\mapping-list.js'
npm WARN tar ENOENT: no such file or directory, open 'D:\0000000000\jiliya\node_modules\.staging\sou                                                                                            rce-map-7bdbe7cc\lib\mapping-list.js'
npm WARN tar ENOENT: no such file or directory, open 'D:\0000000000\jiliya\node_modules\.staging\sou                                                                                            rce-map-fa92b891\lib\quick-sort.js'
npm WARN tar ENOENT: no such file or directory, open 'D:\0000000000\jiliya\node_modules\.staging\sou                                                                                            rce-map-7bdbe7cc\lib\quick-sort.js'
npm WARN tar ENOENT: no such file or directory, open 'D:\0000000000\jiliya\node_modules\.staging\sou                                                                                            rce-map-fa92b891\lib\source-map-consumer.js'
npm WARN tar ENOENT: no such file or directory, open 'D:\0000000000\jiliya\node_modules\.staging\sou                                                                                            rce-map-7bdbe7cc\lib\source-map-consumer.js'
npm ERR! Unexpected end of JSON input while parsing near '...a.24.tgz"},"engines":'

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\suyin\AppData\Roaming\npm-cache\_logs\2018-02-03T02_01_13_210Z-debug.log

解决办法:

npm cache clean --force
rm -rf ~/.npm
# In the project folder:
rm -rf node_modules
rm -f package-lock.json

npm install 安装node包报错

$ npm i
npm ERR! Unexpected token < in JSON at position 210814

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2018-03-07T10_11_14_133Z-debug.log

解决办法:

rm package-lock.json

npm install 安装node包报错

Error: Can't find Python executable "python", you can set the PYTHON env variable

解决办法: 管理员执行:

npm install --global --production windows-build-tools