直到昨天,我的Mac都没有问题。但是今天当我尝试创建或运行角度应用程序时,它无法运行。实际上问题出在节点上。下面是我在终端中给出命令时的响应。请帮助我解决此问题。
Naseefs-MacBook-Pro:cleardeskerp naseefali$ npm install
npm WARN deprecated istanbul@0.4.5: This module is no longer
maintained, try this instead:
npm WARN deprecated npm i nyc
npm WARN deprecated Visit https://istanbul.js.org/integrations for
other alternatives.
npm WARN deprecated circular-json@0.5.9: CircularJSON is in maintenance
only, flatted is its successor.
npm ERR! Unexpected end of JSON input while parsing near '
..."@types/gulp-concat":'
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/naseefali/.npm/_logs/2019-04-16T14_03_05_064Z-debug.log
下面是调试日志的最后一部分。
2164 silly resolveWithNewModule @angular-devkit/build-angular@0.13.8 checking installable status
2165 silly pacote range manifest for karma@~4.0.0 fetched in 8ms
2166 silly resolveWithNewModule karma@4.0.1 checking installable status
2167 silly pacote range manifest for karma-chrome-launcher@~2.2.0 fetched in 9ms
2168 silly resolveWithNewModule karma-chrome-launcher@2.2.0 checking installable status
2169 silly pacote range manifest for karma-coverage-istanbul-reporter@~2.0.1 fetched in 10ms
2170 silly resolveWithNewModule karma-coverage-istanbul-reporter@2.0.5 checking installable status
2171 silly pacote range manifest for karma-jasmine@~1.1.2 fetched in 10ms
2172 silly resolveWithNewModule karma-jasmine@1.1.2 checking installable status
2173 silly pacote range manifest for karma-jasmine-html-reporter@^0.2.2 fetched in 11ms
2174 silly resolveWithNewModule karma-jasmine-html-reporter@0.2.2 checking installable status
2175 silly pacote range manifest for protractor@~5.4.0 fetched in 12ms
2176 silly resolveWithNewModule protractor@5.4.2 checking installable status
2177 silly pacote range manifest for ts-node@~7.0.0 fetched in 9ms
2178 silly resolveWithNewModule ts-node@7.0.1 checking installable status
2179 silly pacote range manifest for tslint@~5.11.0 fetched in 10ms
2180 silly resolveWithNewModule tslint@5.11.0 checking installable status
2181 http fetch GET 200 https://registry.npmjs.org/typescript 12ms (from cache)
2182 silly fetchPackageMetaData error for typescript@~3.2.2 Unexpected end of JSON input while parsing near '..."@types/gulp-concat":'
2183 timing stage:rollbackFailedOptional Completed in 0ms
2184 timing stage:runTopLevelLifecycles Completed in 51557ms
2185 silly saveTree frontend@0.0.0
2185 silly saveTree ├─┬ @angular-devkit/build-angular@0.13.8
2185 silly saveTree │ └─┬ rxjs@6.3.3
2185 silly saveTree │ └── tslib@1.9.3
2185 silly saveTree ├── @angular/animations@7.2.13
2185 silly saveTree ├── @angular/cli@7.3.8
2185 silly saveTree ├── @angular/common@7.2.13
2185 silly saveTree ├── @angular/compiler-cli@7.2.13
2185 silly saveTree ├── @angular/compiler@7.2.13
2185 silly saveTree ├── @angular/core@7.2.13
2185 silly saveTree ├── @angular/forms@7.2.13
2185 silly saveTree ├── @angular/language-service@7.2.13
2185 silly saveTree ├── @angular/platform-browser-dynamic@7.2.13
2185 silly saveTree ├── @angular/platform-browser@7.2.13
2185 silly saveTree ├── @angular/router@7.2.13
2185 silly saveTree ├── @types/jasmine@2.8.16
2185 silly saveTree ├── @types/jasminewd2@2.0.6
2185 silly saveTree ├── @types/node@8.9.5
2185 silly saveTree ├── codelyzer@4.5.0
2185 silly saveTree ├── core-js@2.6.5
2185 silly saveTree ├── jasmine-core@2.99.1
2185 silly saveTree ├── jasmine-spec-reporter@4.2.1
2185 silly saveTree ├── karma-chrome-launcher@2.2.0
2185 silly saveTree ├── karma-coverage-istanbul-reporter@2.0.5
2185 silly saveTree ├─┬ karma-jasmine-html-reporter@0.2.2
2185 silly saveTree │ └── karma-jasmine@1.1.2
2185 silly saveTree ├── karma-jasmine@1.1.2
2185 silly saveTree ├── karma@4.0.1
2185 silly saveTree ├── protractor@5.4.2
2185 silly saveTree ├── rxjs@6.3.3
2185 silly saveTree ├── ts-node@7.0.1
2185 silly saveTree ├── tslib@1.9.3
2185 silly saveTree ├── tslint@5.11.0
2185 silly saveTree └── zone.js@0.8.29
2186 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '..."@types/gulp-concat":'
2186 verbose stack at JSON.parse (<anonymous>)
2186 verbose stack at parseJson (/usr/local/lib/node_modules/npm/node_modules/json-parse-better-errors/index.js:7:17)
2186 verbose stack at consumeBody.call.then.buffer (/usr/local/lib/node_modules/npm/node_modules/node-fetch-npm/src/body.js:96:50)
2186 verbose stack at process._tickCallback (internal/process/next_tick.js:68:7)
2187 verbose cwd /Users/naseefali/Desktop/ClearDesk/CD_ERP/frontend
2188 verbose Darwin 18.2.0
2189 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--quiet"
2190 verbose node v10.15.3
2191 verbose npm v6.4.1
2192 error Unexpected end of JSON input while parsing near '..."@types/gulp-concat":'
2193 verbose exit [ 1, true ]
答案 0 :(得分:1)
这似乎是npm-cache的问题。 清除npm缓存,如果PLAN A不起作用,从文件夹中删除完整的npm缓存和npm文件,然后将其完全重新安装。
从项目目录中删除您的package-lock.json
文件。
删除您的node_modules
运行npm cache clean --f
npm install
答案 1 :(得分:0)