Node.js NPM |安装模块时出错

Node.js NPM |安装模块时出错,node.js,npm,Node.js,Npm,当我尝试安装某些模块时,出现以下错误: npm错误!在分析附近区域时JSON输入意外结束 “…”hjs:“~0.0.6”,“马克” npm ERR!此运行的完整日志可在以下位置找到:npm ERR! C:\Users\omare\AppData\Roaming\npm-cache\u logs\2018-07-30T09\u 21\u 147Z-debug.log 在日志文件中,我得到以下信息: 0 info it worked if it ends with ok 1 verbose cli

当我尝试安装某些模块时,出现以下错误:

npm错误!在分析附近区域时JSON输入意外结束 “…”hjs:“~0.0.6”,“马克”

npm ERR!此运行的完整日志可在以下位置找到:npm ERR!
C:\Users\omare\AppData\Roaming\npm-cache\u logs\2018-07-30T09\u 21\u 147Z-debug.log

在日志文件中,我得到以下信息:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'i',
1 verbose cli   'express' ]
2 info using npm@5.6.0
3 info using node@v8.11.3
4 verbose npm-session 1b65207ea7164d4e
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 http fetch GET 304 https://registry.npmjs.org/express 1289ms (from cache)
8 silly fetchPackageMetaData error for express@^4.15.3 Unexpected end of JSON input while parsing near '..."hjs":"~0.0.6","marke'
9 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '..."hjs":"~0.0.6","marke'
9 verbose stack     at JSON.parse (<anonymous>)
9 verbose stack     at parseJson (C:\Program Files\nodejs\node_modules\npm\node_modules\pacote\node_modules\make-fetch-happen\node_modules\node-fetch-npm\node_modules\json-parse-better-errors\index.js:7:17)
9 verbose stack     at consumeBody.call.then.buffer (C:\Program Files\nodejs\node_modules\npm\node_modules\pacote\node_modules\make-fetch-happen\node_modules\node-fetch-npm\src\body.js:96:50)
9 verbose stack     at <anonymous>
9 verbose stack     at process._tickCallback (internal/process/next_tick.js:188:7)
10 verbose cwd H:\Projects\WEB Development\My Stuff\Nuxt
11 verbose Windows_NT 10.0.17134
12 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "i" "express"
13 verbose node v8.11.3
14 verbose npm  v5.6.0
15 error Unexpected end of JSON input while parsing near '..."hjs":"~0.0.6","marke'
16 verbose exit [ 1, true ]
0信息如果它以ok结尾,它就工作了
1详细cli['C:\\Program Files\\nodejs\\node.exe',
1 verbose cli'C:\\Program Files\\nodejs\\node\u modules\\npm\\bin\\npm cli.js',
1详细cli“i”,
1详细cli“express”]
2信息使用npm@5.6.0
3信息使用node@v8.11.3
4详细的npm会议1b65207ea7164d4e
5.安装loadCurrentTree
6.安装readLocalPackageData
7 http获取304https://registry.npmjs.org/express 1289ms(从缓存)
8在分析“…”hjs附近时,express@^4.15.3 JSON输入意外结束时出现以下错误:“~0.0.6”,“marke”
9详细堆栈语法错误:在分析“…”hjs“:“~0.0.6”,“marke”附近时JSON输入意外结束
9 JSON.parse()处的详细堆栈
9 parseJson的详细堆栈(C:\Program Files\nodejs\node\u modules\npm\node\u modules\pacote\node\u modules\make fetch\node\u modules\node fetch npm\node\u modules\json parse better errors\index.js:7:17)
9 consumerbody.call.then.buffer上的详细堆栈(C:\Program Files\nodejs\node\U modules\npm\node\U modules\pacote\node\U modules\make fetch Occess\node\U modules\node fetch npm\src\body.js:96:50)
9详细堆栈位于
9进程处的详细堆栈。_tickCallback(internal/process/next_tick.js:188:7)
10详细cwd H:\Projects\WEB Development\My Stuff\Nuxt
11详细窗口\u NT 10.0.17134
12详细argv“C:\\Program Files\\nodejs\\node.exe”“C:\\Program Files\\nodejs\\node\U模块\\npm\\bin\\npm cli.js”“i”“express”
13详细节点v8.11.3
14详细的npm v5.6.0
15在分析“…”hjs“:“~0.0.6”,“marke”附近时,JSON输入意外结束时出错
16详细退出[1,true]
My package.json文件:

{
  "name": "mevn",
  "version": "1.0.0",
  "description": "MongoDb, Express, Vue.js, and Node.js stack workflow",
  "main": "app.js",
  "scripts": {
    "start-server": "node server/bin/www",
    "dev": "webpack-dev-server --inline --progress --config Client/build/webpack.dev.conf.js",
    "start-client": "npm run dev",
    "build-client": "node Client/build/build.js"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/Omar-Hussein/MEVN.git"
  },
  "keywords": [
    "workflow",
    "mevn",
    "mongodb",
    "express",
    "node",
    "vue"
  ],
  "author": "Omar Hussein",
  "license": "WTFPL",
  "bugs": {
    "url": "https://github.com/Omar-Hussein/MEVN/issues"
  },
  "homepage": "https://github.com/Omar-Hussein/MEVN#readme",
  "engines": {
    "node": ">= 6.0.0",
    "npm": ">= 3.0.0"
  },
  "browserslist": [
    "> 1%",
    "last 2 versions",
    "not ie <= 8"
  ],
  "dependencies": {
    "axios": "^0.18.0",
    "connect-mongo": "^2.0.1",
    "cors": "~2.8.4",
    "debug": "^3.1.0",
    "express-session": "^1.15.6",
    "express-validator": "^5.3.0",
    "http-errors": "^1.6.3",
    "lodash": "^4.17.10",
    "mongoose": "^5.2.5",
    "morgan": "^1.9.0",
    "vue": "^2.5.16",
    "vue-router": "^3.0.1",
    "vuetify": "^1.1.8",
    "vuex": "^3.0.1",
    "vuex-persistedstate": "^2.5.4",
    "vuex-router-sync": "^5.0.0"
  },
  "devDependencies": {
    "autoprefixer": "^9.0.1",
    "babel": "^6.23.0",
    "babel-helper-vue-jsx-merge-props": "^2.0.3",
    "babel-loader": "^7.1.5",
    "babel-plugin-syntax-jsx": "^6.18.0",
    "babel-plugin-transform-runtime": "^6.23.0",
    "babel-plugin-transform-vue-jsx": "^3.7.0",
    "babel-preset-env": "^1.7.0",
    "babel-preset-stage-2": "^6.24.1",
    "chalk": "^2.4.1",
    "copy-webpack-plugin": "^4.5.2",
    "css-loader": "^1.0.0",
    "extract-text-webpack-plugin": "^3.0.2",
    "file-loader": "^1.1.11",
    "friendly-errors-webpack-plugin": "^1.7.0",
    "html-webpack-plugin": "^3.2.0",
    "material-design-icons-iconfont": "^3.0.3",
    "node-notifier": "^5.2.1",
    "optimize-css-assets-webpack-plugin": "^5.0.0",
    "ora": "^3.0.0",
    "portfinder": "^1.0.13",
    "postcss-import": "^11.1.0",
    "postcss-loader": "^2.1.6",
    "postcss-url": "^7.3.2",
    "rimraf": "^2.6.2",
    "semver": "^5.5.0",
    "shelljs": "^0.8.2",
    "uglifyjs-webpack-plugin": "^1.2.7",
    "url-loader": "^1.0.1",
    "vue-loader": "^15.2.6",
    "vue-style-loader": "^4.1.1",
    "vue-template-compiler": "^2.5.16",
    "webpack": "^4.16.3",
    "webpack-merge": "^4.1.3"
  }
}
{
“名称”:“mevn”,
“版本”:“1.0.0”,
“说明”:“MongoDb、Express、Vue.js和Node.js堆栈工作流”,
“main”:“app.js”,
“脚本”:{
“启动服务器”:“节点服务器/bin/www”,
“dev”:“webpack dev server--inline--progress--config Client/build/webpack.dev.conf.js”,
“启动客户端”:“npm运行开发”,
“构建客户端”:“节点客户端/build/build.js”
},
“存储库”:{
“类型”:“git”,
“url”:“git”+https://github.com/Omar-Hussein/MEVN.git"
},
“关键词”:[
“工作流程”,
“mevn”,
“mongodb”,
“快车”,
“节点”,
“vue”
],
“作者”:“奥马尔·侯赛因”,
“许可证”:“WTFPL”,
“臭虫”:{
“url”:”https://github.com/Omar-Hussein/MEVN/issues"
},
“主页”:https://github.com/Omar-Hussein/MEVN#readme",
“发动机”:{
“节点”:“>=6.0.0”,
“npm”:“>=3.0.0”
},
“浏览者”:[
"> 1%",
“最后两个版本”,
“不要尝试执行

npm cache clean
然后做一个

npm install

希望这能有所帮助!

在努力解决这个问题后,最终对我有效的是

npm缓存清理--强制


npm安装

检查你的
包.json
,似乎它的json格式不好。你能用你的
包.json
文件内容更新你的帖子吗?你的
包.json
包含一个引号,它的位置不正确,你需要格式化,我认为问题不在于我的
包.json
文件我在没有
package.json
文件的多个文件夹中尝试了这一点。无论如何,我已经添加了它…我必须使用force标志,但这对我来说也很有效