简体   繁体   English

尝试创建新的角度项目时出错

[英]Error while trying to create new angular project

Till yesterday, there was no problem with my mac. 到昨天为止,我的Mac没问题。 But when today when i am trying to create or run an angular application, it fails to run. 但是今天当我尝试创建或运行角度应用程序时,它无法运行。 Actually the problem is with the node. 实际上问题出在节点上。 Below is the response when i give the command in terminal. 下面是我在终端中给出命令时的响应。 Please help me in resolving this issue. 请帮助我解决此问题。

    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

Below is the last part of the 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 ]

This seems to be a problem with npm-cache. 这似乎是npm-cache的问题。 Clear the npm cache, If PLAN A doesn't work , Delete the complete npm cache and npm files from the folder and re-install it completely. 清除npm缓存,如果PLAN A不起作用,从文件夹中删除完整的npm缓存和npm文件,然后完全重新安装。

  1. Delete your package-lock.json file from the project directory. 从项目目录中删除您的package-lock.json文件。

  2. Delete your node_modules 删除您的node_modules

  3. run npm cache clean --f 运行npm cache clean --f

  4. run npm install 运行npm install

It might be a NPM cache problem. 这可能是NPM缓存问题。 Try this to repair NPM's cache. 试试这个来修复NPM的缓存。

npm cache verify

For more information, see https://docs.npmjs.com/cli/cache.html 有关更多信息,请参见https://docs.npmjs.com/cli/cache.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM