Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
npm i chai--保存开发问题_Npm_Mocha.js_Chai - Fatal编程技术网

npm i chai--保存开发问题

npm i chai--保存开发问题,npm,mocha.js,chai,Npm,Mocha.js,Chai,我正在使用mocha对javascript进行单元测试 我正在使用chai管理断言 键入npm i chai--save dev后,我获得以下错误: C:\Users\ABDELHAK>npm i chai --save-dev npm ERR! Windows_NT 6.1.7601 npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bi

我正在使用mocha对javascript进行单元测试
我正在使用chai管理断言
键入
npm i chai--save dev
后,我获得以下错误:

C:\Users\ABDELHAK>npm i chai --save-dev
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "i" "chai" "--save-dev"
npm ERR! node v0.10.18
npm ERR! npm  v2.12.1
npm ERR! file C:\Users\ABDELHAK\AppData\Roaming\npm-cache\chai\3.5.0\package\package.json
npm ERR! code EJSONPARSE

npm ERR! Failed to parse json
npm ERR! Unexpected token '\u0000' at 1:1
npm ERR!
npm ERR! ^
npm ERR! File: C:\Users\ABDELHAK\AppData\Roaming\npm-cache\chai\3.5.0\package\package.json
npm ERR! Failed to parse package.json data.
npm ERR! package.json must be actual JSON, not just JavaScript.
npm ERR!
npm ERR! This is not a bug in npm.
npm ERR! Tell the package author to fix their package.json file. JSON.parse

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\ABDELHAK\npm-debug.log

请注意,mocha命令工作正常。

Hmm看起来像npm缓存中的一个空package.json文件。也许清洁它会对你有帮助

$ npm cache clean once
  • 首先使用以下命令删除注册表:npm config delete registry
  • 清除缓存:npm缓存清除--强制
  • 然后运行命令:npmichai--savedev

  • 希望有帮助。

    您是否按照错误消息的建议执行了操作?很抱歉,我是npm的新手,无法重新发送此错误消息??我应该更新节点版本吗?这个问题在太平npm中得到解决,然后>npm I chai--保存开发