[英]npm ERR! Unexpected end of JSON input while parsing near '…w2BfLygJAO9ZBvYIqZTld'
[英]“npm err: Unexpected end of JSON input” when installing express-mysql-session
我正在开发一个 nodejs 项目,该项目使用passportjs 验证用户。 我正在使用 mysql 作为数据库。 现在我想使用“ express-mysql-session ”包实现会话存储。
当我使用 npm 安装express-mysql-session 时,它显示此错误:
$ npm install express-mysql-session --save
npm ERR! Unexpected end of JSON input while parsing near '...ies":{"express":"3.3.'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\user\AppData\Roaming\npm-cache\_logs\2021-07-22T10_22_41_836Z-debug.log
但是当我安装任何其他软件包时,它已成功安装
这是运行的“完整日志” :
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'C:\\Program Files (x86)\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'install',
1 verbose cli 'express-mysql-session',
1 verbose cli '--save'
1 verbose cli ]
2 info using npm@6.14.4
3 info using node@v12.18.0
4 verbose npm-session 63020bd35662f4f0
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 http fetch GET 200 https://registry.npmjs.org/express-mysql-session 20ms (from cache)
8 silly fetchPackageMetaData error for express-mysql-session@latest Unexpected end of JSON input while parsing near '...ies":{"express":"3.3.'
9 timing stage:rollbackFailedOptional Completed in 1ms
10 timing stage:runTopLevelLifecycles Completed in 367ms
11 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '...ies":{"express":"3.3.'
11 verbose stack at JSON.parse (<anonymous>)
11 verbose stack at parseJson (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\json-parse-better-errors\index.js:7:17)
11 verbose stack at C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-fetch-npm\src\body.js:96:50
11 verbose stack at processTicksAndRejections (internal/process/task_queues.js:97:5)
12 verbose cwd D:\Projects\AppName
13 verbose Windows_NT 6.1.7601
14 verbose argv "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "express-mysql-session" "--save"
15 verbose node v12.18.0
16 verbose npm v6.14.4
17 error Unexpected end of JSON input while parsing near '...ies":{"express":"3.3.'
18 verbose exit [ 1, true ]
这是“package.json”文件:
{
"name": "App Name",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"bcrypt": "^5.0.1",
"body-parser": "^1.19.0",
"dotenv": "^8.2.0",
"ejs": "^3.1.5",
"express": "^4.17.1",
"express-flash": "0.0.2",
"express-session": "^1.17.2",
"my-sql": "^1.2.15",
"mysql": "^2.18.1",
"passport": "^0.4.1",
"passport-local": "^1.0.0",
}
}
在其他项目中安装时它不起作用。
现在我该怎么办???
感谢所有试图回答的人。
可能损坏的缓存?
npm cache clean --force
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.