安装快速 mysql 会话时"npm err: Unexpected end of JSON input"



我正在开发一个nodejs项目,该项目使用passportjs对用户进行身份验证。我使用mysql作为数据库。现在我想使用">express mysql会话";包裹

当我使用npm安装express mysql会话时,它显示以下错误:

$ 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:UsersuserAppDataRoamingnpm-cache_logs2021-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)nodejsnode_modulesnpmnode_modulesjson-parse-better-errorsindex.js:7:17)
11 verbose stack     at C:Program Files (x86)nodejsnode_modulesnpmnode_modulesnode-fetch-npmsrcbody.js:96:50
11 verbose stack     at processTicksAndRejections (internal/process/task_queues.js:97:5)
12 verbose cwd D:ProjectsAppName
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

相关内容

最新更新