Error reading package: graceful-fs \ package.json

I recently installed Node.js, npm, ionic and cordova, as described in Ionic Getting Started

Now when I open the Visual Studio project, the Bower / NPM window displays the following error:

System.AggregateException: One or more errors occurred. ---> Microsoft.NodejsTools.Npm.PackageJsonException: error reading package.json at 'C: \ Users \ Colin \ AppData \ Roaming \ NPM \ node_modules \ Cordova \ node_modules \ NPM \ node_modules \ elegant fs \ package.json': Error reading package.json. The file may be processed by JSON, but may contain objects with duplicate properties.

This is due to a problem with the npm package . So how do I do this? Install an earlier version of Node, npm, cordova or graceful-fs? And how to do it?

EDIT Following a comment from Vikas Vats, I executed the following commands:

cordova -v They tell me that my global version is 5.3.3

npm uninstall -g cordova

npm install -g cordova@4.3.0

Now I get the same error reported in graceful-fs\package.json , but this time it is in a different place:

C: \ Users \ Colin \ AppData \ Roaming \ NPM \ node_modules \ ionic \ node_modules \ ion-application PB \ node_modules \ ion-Cordova PB \ node_modules \ NPM \ node_modules \ elegant fs \ package.json

+7
npm cordova ionic
source share
2 answers

I deleted the cord - returning it to the version of Visual Studio, it was tested with:

 npm uninstall -g cordova npm install -g cordova@4.3.0 

This moved the error to ionic. So I then took Ionic back to version 1.6.5:

 npm uninstall -g ionic npm install -g ionic@1.6.5 

This is fixed by graceful-fs / package.json file. I copied the content here:

 { "author": { "name": "Isaac Z. Schlueter", "email": " i@izs.me ", "url": "http://blog.izs.me" }, "name": "graceful-fs", "description": "A drop-in replacement for fs, making various improvements.", "version": "2.0.0", "repository": { "type": "git", "url": "git://github.com/isaacs/node-graceful-fs.git" }, "main": "graceful-fs.js", "engines": { "node": ">=0.4.0" }, "directories": { "test": "test" }, "scripts": { "test": "tap test/*.js" }, "keywords": [ "fs", "module", "reading", "retry", "retries", "queue", "error", "errors", "handling", "EMFILE", "EAGAIN", "EINVAL", "EPERM", "EACCESS" ], "license": "BSD", "readme": "# graceful-fs\n\ngraceful-fs functions as a drop-in replacement for the fs module,\nmaking various improvements.\n\nThe improvements are meant to normalize behavior across different\nplatforms and environments, and to make filesystem access more\nresilient to errors.\n\n## Improvements over fs module\n\ngraceful-fs:\n\n* keeps track of how many file descriptors are open, and by default\n limits this to 1024. Any further requests to open a file are put in a\n queue until new slots become available. If 1024 turns out to be too\n much, it decreases the limit further.\n* fixes `lchmod` for Node versions prior to 0.6.2.\n* implements `fs.lutimes` if possible. Otherwise it becomes a noop.\n* ignores `EINVAL` and `EPERM` errors in `chown`, `fchown` or\n `lchown` if the user isn't root.\n* makes `lchmod` and `lchown` become noops, if not available.\n* retries reading a file if `read` results in EAGAIN error.\n\nOn Windows, it retries renaming a file for up to one second if `EACCESS`\nor `EPERM` error occurs, likely because antivirus software has locked\nthe directory.\n\n## Configuration\n\nThe maximum number of open file descriptors that graceful-fs manages may\nbe adjusted by setting `fs.MAX_OPEN` to a different number. The default\nis 1024.\n", "readmeFilename": "README.md", "bugs": { "url": "https://github.com/isaacs/node-graceful-fs/issues" }, "_id": " graceful-fs@2.0.0 ", "_from": " graceful-fs@2 " } 

I also tried the next release of Ionic - 1.7.0 , and the most recent - 1.7.7 . The problem has returned, so I will stick to version 1.6.5

Link Ionic Releases

0
source share

From https://github.com/npm/npm/issues/9965

Open C:\Users\Colin\AppData\Roaming\npm\node_modules\ionic\node_modules\ionic-app-lib\node_modules\ionic-cordova-lib\node_modules\npm\node_modules\graceful-fs\package.json in a text editor and remove the duplicate root keys:

  • engines
  • gitHead
  • mistakes
  • the main
  • _id
  • _shasum
  • _from
  • _npmVersion
  • _nodeVersion
  • _npmUser
  • distance
  • repository
  • version

Root keys must be present only once in package.json

0
source share

All Articles