-
npm ERR! Unexpected token in JSON at position 1 while parsing near
2020-01-17 16:30:51执行npm 任何命令报错 ... in JSON at position 1 while parsing near ' npm ERR! <!doctype html> npm ERR! <htm...' npm ERR! A complete log of this run can be found in: 报错如下图:...执行npm 任何命令报错
PS C:\WINDOWS\system32> npm install vue-cli -g npm ERR! Unexpected token < in JSON at position 1 while parsing near ' npm ERR! <!doctype html> npm ERR! <htm...' npm ERR! A complete log of this run can be found in:
报错如下图:
原因:
这种问题一般是由于网络原因导致下载的某些依赖的文件损坏,可以使用淘宝NPM镜像,设置方法为:npm config set registry https://registry.npm.taobao.org
设置完成后,重新执行
-
x=n,y=0;//n>1 while(x>=(y+1)*(y+1)) y++; 求时间复杂度
2018-09-16 15:15:52题目:试分析该算法的时间复杂度。...while(x>=(y+1)*(y+1)) y++; 此题x>=(y+1)*(y+1)可转换为 n>=(y+1)*(y+1)即有n^0.5>=y+1 所以y<=n^0.5-1 因此时间复杂度为 o(n^0.5)...题目:试分析该算法的时间复杂度。
x=n;//n>1 y=0; while(x>=(y+1)*(y+1)) y++;
此题x>=(y+1)*(y+1)可转换为
n>=(y+1)*(y+1)即有n^0.5>=y+1
所以y<=n^0.5-1
因此时间复杂度为 o(n^0.5)
-
用create-react-app创建APP出错或者npm ERR! Unexpected token in JSON at position 1 while parsing near
2018-10-11 15:28:57npm install -g create-react-app create-react-app first-app 这种问题一般是由于网络原因导致下载的某些依赖的文件损坏,可以使用淘宝NPM镜像,设置方法为: ... 设置完成后,重新执行 create-react-app first-a...npm install -g create-react-app create-react-app first-app
这种问题一般是由于网络原因导致下载的某些依赖的文件损坏,可以使用淘宝NPM镜像,设置方法为:npm config set registry https://registry.npm.taobao.org
设置完成后,重新执行
create-react-app first-app
-
ubifs烧写遇到《UBI error: ubi_io_read: error -1 while reading 64 bytes from PEB》
2015-09-03 15:19:11UBI error: ubi_io_read: error -1 while reading 64 bytes from PEB 128:0, read 0 byte slab error in kmem_cache_destroy(): cache `ubi_scan_leb_slab': Can't free all objects Backtrace: [] (dump_backtrace...终于移植好了2.6.39的内核,烧写ubi文件系统后,第一次打印到/init初始化了,虽然oops了,但还是感觉离最后的成功越来越近了。
可是,偶然断电重启发现,debug口打印却和第一次不一样了,在attach mtd的时候,内核已经开始打印了一些错误,如下
尝试了多次均是一样的情况。第一次烧写时,可以跑到最后的地方3 cmdlinepart partitions found on MTD device atmel_nand Creating 3 MTD partitions on "atmel_nand": 0x000000000000-0x000000500000 : "bstrap/uboot/kernel" 0x000000500000-0x000002500000 : "rootfs" 0x000002500000-0x000008000000 : "usrdata" UBI: attaching mtd1 to ubi0 UBI: physical eraseblock size: 131072 bytes (128 KiB) UBI: logical eraseblock size: 126976 bytes UBI: smallest flash I/O unit: 2048 UBI: VID header offset: 2048 (aligned 2048) UBI: data offset: 4096 atmel_nand atmel_nand: Too many error. atmel_nand atmel_nand: Too many error. atmel_nand atmel_nand: Too many error. atmel_nand atmel_nand: Too many error. UBI error: ubi_io_read: error -1 while reading 64 bytes from PEB 128:0, read 0 byte slab error in kmem_cache_destroy(): cache `ubi_scan_leb_slab': Can't free all objects Backtrace: [<c003b898>] (dump_backtrace+0x0/0x104) from [<c0352cf0>] (dump_stack+0x18/0x1c) r6:c7875000 r5:c7951ce0 r4:c78a30c0 [<c0352cd8>] (dump_stack+0x0/0x1c) from [<c00a6150>] (kmem_cache_destroy+0x90/0xf8) [<c00a60c0>] (kmem_cache_destroy+0x0/0xf8) from [<c02264dc>] (ubi_scan+0x6b8/0x9ac) r4:00000080 [<c0225e24>] (ubi_scan+0x0/0x9ac) from [<c021e4b4>] (ubi_attach_mtd_dev+0x41c/0xa08)
但是重启后,就在ubi最开始探测的时候就已经出问题了。网上各种放狗搜,各种说法都有。VFS: Mounted root (ubifs filesystem) on device 0:12. Freeing init memory: 136K Failed to execute /init. Attempting defaults... Kernel panic - not syncing: Attempted to kill init! Backtrace: [<c003b898>] (dump_backtrace+0x0/0x104) from [<c0352cf0>] (dump_stack+0x18/0x1c) r6:c781a00c r5:00000004 r4:c0489878 [<c0352cd8>] (dump_stack+0x0/0x1c) from [<c0352e70>] (panic+0x5c/0x188) [<c0352e14>] (panic+0x0/0x188) from [<c004b8b4>] (do_exit+0x98/0x644) r3:c046c394 r2:c7819cfc r1:c781be5c r0:c0403e44 r7:c781a00c [<c004b81c>] (do_exit+0x0/0x644) from [<c004bef8>] (do_group_exit+0x5c/0xc4) r7:c781cd60 [<c004be9c>] (do_group_exit+0x0/0xc4) from [<c0055eac>] (get_signal_to_deliver+0x30c/0x348) r4:00000004 [<c0055ba0>] (get_signal_to_deliver+0x0/0x348) from [<c003ac00>] (do_signal+0xc8/0x5a0) [<c003ab38>] (do_signal+0x0/0x5a0) from [<c003b3f8>] (do_notify_resume+0x20/0x74) [<c003b3d8>] (do_notify_resume+0x0/0x74) from [<c0038b94>] (work_pending+0x24/0x28) r4:00000000
于是,各种排除。怀疑的方向主要是这样的,为什么第一次是好好的,重启后不行了呢?是因为第一次运行修改了flash的数据??破坏了文件系统结构?如果是这样,谁修改的?是内核??内核做什么了???在什么地方修改的???其实,这些疑问排查起来非常困难。
于是,在想,是不是ECC校验出的问题。但是转念一想,uboot 就是配置的4BIT的pmecc,kernel也是一样。亲手修改的代码啊!!!!
想了一上午,没头绪。还是看看代码吧,果不然,有个变量写错了。
} if (nand_chip->ecc.mode == NAND_ECC_HW) { /* ECC is calculated for the whole page (1 step) */ nand_chip->ecc.size = mtd->writesize; //modified by zhaozx /* set ECC page size and oob layout */ switch (mtd->writesize) { case 2048: nand_chip->ecc.bytes = 28; nand_chip->ecc.steps = 1; nand_chip->ecc.layout = &pmecc_oobinfo_2048; host->mm = GF_DIMENSION_13; host->nn = (1 << host->mm) - 1; /* 4-bits correction */ host->tt = 4; host->sector_size = 512; host->sector_number = mtd->writesize / host->sector_size; host->ecc_bytes_per_sector = 7;///BUG here.这个地方官方默认是2bit校验是4。现在用4bit ecc应该是7,悲剧!!!! host->alpha_to = pmecc_get_alpha_to(host); host->index_of = pmecc_get_index_of(host); break;
结论:真相只有一个,就是在代码里!!!!
从打印入手:
关键的打印信息[UBI error: ubi_io_read: error -1 while reading 64 bytes from PEB 128:0, read 0 byte]
这句话直面的意思就是,从flash读数据,结果一个字节没读出来????为什么,直观的感觉就是ecc校验出问题了。
因为用到的pmecc,校验码是硬件写入到flash的。如果此时对pmecc的寄存器的配置,与写数据时的配置不一样,那么必然会出问题。
所以,推测,问题应该出在ecc的校验!!也就是上面说的,发现代码的书写有个bug!!!
-
关于while 1 和 while True的不同
2018-10-20 10:53:45在python2中,True和False并不是关键字,while 1 的运行性能会比 while True更好, 而在python3中,True和False是关键字,while 1 的运行性能和 while True一样, import dis: def whileOne(): while 1: ... -
while(1){}和while(1);
2020-03-21 16:58:12阅读目录while(1);while(1){ 代码 }参考资料 单片机中while(1)有两种用途, while(1); 意义:这是一个死循环,代码不再向下执行。 用途: 一般在调试代码时,为了检测一部分代码是否OK,防止后面的代码干扰执行... -
while(0),while(1),while(表达式)
2016-10-30 22:11:48while(0)表示不执行循环语句,while(1)表示执行语句。 while(0) while('\0') while(a='\0') 上面三种情况等价,因为他们的值都是0。特别是对于while(a='\0'),while判断的是表达式赋值之后a的值... -
shell while true
2019-04-10 13:39:577.while循环注意为方括号[],且注意空格 min=1 max=100 while [ $min -le $max ] do echo $min min=`expr $min + 1` done 8.双括号形式,内部结构有点像C的语法,注意赋值:i=$(($i+1)) i=1 while(($i<100)) do... -
while(*s)或while(1)的意思
2019-01-26 15:56:20while(*s) 是 while(*s!=0) 的缩写 while(1) 是 while(1!=0)//这是一个死循环 的缩写 -
python使用while循环,输出1-100的奇数和偶数
2020-08-11 19:48:36python使用while循环,输出1-100的奇数和偶数(奇数偶数没分开): a=1 while a<=100: if a%2==0: print(“偶数:%s” %c) else: print(“奇数:%s” %c) a+=1 -
python通过while循环计算1到n的和的代码
2019-03-31 14:18:05把内容过程中比较重要的内容收藏起来,如下内容是关于python通过while循环计算1到n的和的内容。def sum(n): result = 0 i = 1 while i <= n: result += i i += 1 return result 复制代码 ... -
while(1)与while(表达式)
2017-05-14 10:40:41while(1)其中1代表一个常量表达式,他永远不会等于0。所以,循环会一直执行下去。除非你设置break等类似的跳出循环语句循环才会中止。 while(i--)其中i是一个变量,因此表达式i--有不同的值,依次递减(i--是先... -
linux while循环
2014-12-14 19:13:12while循环的格式 while expression ...1、计数器控制的while循环 #!/bin/sh int=1 while(( $int do echo $int let "int++" done 2、结束标记控制的while循环 #用脚本演示使用结 -
写代码:使用while循环输出1~100的所有偶数
2018-11-17 22:03:00# 使用while循环输出1~100的所有偶数number = 1while number <= 100: if number % 2 == 0: print("%s" %number) else: pass number += 1 转载于:https://www.cnblogs.com/demilyc/p/9975878.html... -
while(1)的作用
2018-03-31 08:59:06单片机中while(1)有两种用途,while(1);意义:这是一个死循环,代码不再向下执行。用途:1. 一般在调试代码时,为了检测一部分代码是否OK,防止后面的代码干扰执行结果,会在观测点加上while(1);2.有些代码检测到... -
1.while循环实现打印1到10
2019-09-30 09:16:37while循环实现打印1到10 /** * [说明]:while循环实现打印1到10 * @author aeon */ public class TestWhile { public static void main(String[] args) { int i = 1;// 变量初始化 while (i <= 1.... -
bash shell while语法
2016-09-27 11:18:08在编写脚本时,一定要注意空格基本语法:while [ condition ] do command1 command2 command3 donecondition为true时命令1到命令3将会一直执行,知道条件为false ,例如: #!/bin/bash x=1 while [ $x -le 5 ] do ... -
写代码:使用while输出1~100内的所有奇数
2018-11-17 22:02:00# 使用while输出1~100内的所有奇数number = 1while number <= 100: if number % 2 == 1: print("%s" %number) else: pass number += 1 转载于:https://www.cnblogs.com/demilyc/p/9975870.html... -
汇编语言while和dowhile实现1到100求和
2019-04-18 19:05:03include vcIO.inc .data .code main proc ; eax sum, ebx n ...mov ebx,1 ;do while ;--entry: ;--add eax,ebx ;--inc ebx ;--cmp ebx, 100 ;--jbe entry ;while do jmp while_body entry: add eax,... -
把a=[[1,2,3],[4,5],[6,7,8,9],['a','b','c']]中元素逐个输出,五种方式(while while ;while for ;for ...
2019-02-21 11:38:21while - while a=[[1,2,3],[4,5],[6,7,8,9],[‘a’,‘b’,‘c’]] i=0 while i&amp;lt;len(a): j=0 while j&amp;lt;len(a[i]): print(a[i][j],end=(’ ')) j+=1 print() i+=1 while - for... -
Bash Shell 中的while 循环、 do...while
2020-04-06 19:24:48文章目录1、求 10 以内每个整数的平方值:5、使用 while 循环 的嵌套来实现打印三角形: 此链接通往 Bash Shell 编程学习的目录导航 ,从入门到放弃,感兴趣的可以去看看: 1... -
单片机 while(1)
2018-07-08 16:32:44摘抄自--CSDN a1232345 单片机中while(1)有两种用途,while(1);意义:这是一个死循环,代码不再向下执行。用途:1.让主函数只循环一次2.一般在调试代码时,为了检测一部分代码是否OK,防止后面的代码干扰执行结果,... -
Python基础练习之while语句:1~100累积和,1~100偶数,奇数累积和
2019-02-19 17:00:521~100累积和 sum = 0 i = 1 while i<=100: sum = sum + i i += 1 print('1到100累积和:%d'% sum) 运行结果: 1到100累积和:5050 1~100偶数累积和 i = 1 sum = 0 while i<=100: if i%2 == 0: ... -
SQL Server(通过while 计算1---100之间奇数的和。通过while 计算1---100之间偶数的和。)
2012-11-08 19:32:03通过while 计算1---100之间奇数的和。 declare @sum int =0 declare @i int =1 while @i begin if @i%2 begin set @sum=@sum+@i end set @i=@i+1 end print @sum 通过while ... -
Python的while循环
2017-11-22 11:09:41Python中while语句的一般形式: while 判断条件: 语句 同样需要注意冒号和缩进。另外,在Python中没有do..while循环。 实例:计算1到100的和 n =100 sum =0 counter =1 while counter n: sum = ... -
python 使用while循环输出1 2 3 4 5 6 8 9 10
2018-10-08 21:01:39#输出1 2 3 4 5 6 8 9 10 n=1 while n<11: if n==7: pass else: print(n) n=n+1 -
20-使用while循环求从1累加至100的值
2019-05-14 12:46:00累计从1加到100的和 sum100 = 0 ...while counter < 101: sum100 += counter counter += 1 print(sum100) 输出结果: 转载于:https://www.cnblogs.com/hejianping/p/10861595.html... -
while(1);
2014-12-30 16:41:12while(1){ } 即 WHILE(1); 就是永远循环的意思(永远阻塞)。 while是当条件为真(就是为1)是执行{}中的指令,而这条指令{}为空,就是什么都不执行,而条件永远为真,所以程序就一直在这里执行,不向下走了。 ... -
流程控制:while/until循环
2016-07-08 10:49:01用while循环输出1到5的数字,while的命令语法是:while commands; do commands; done具体demo如下:#!/bin/bash #while-count:display a series of numbers count=1 while [ $count -le 5 ]; do echo $count count=$...