Unable to run npm install successfully due to unmet peer dependencies - json

I have package.json file in which following devDependencies are mentioned:
"devDependencies": {
"bower": "^1.7.7",
"connect-ssi": "^1.1.0",
"grunt": "~0.4.5",
"grunt-contrib-compass": "^1.1.0",
"grunt-contrib-concat": "~0.4.0",
"grunt-contrib-connect": "^0.11.2",
"grunt-contrib-handlebars": "^0.11.0",
"grunt-contrib-jshint": "~0.10.0",
"grunt-contrib-qunit": "~0.5.2",
"grunt-contrib-sass": "^0.9.2",
"grunt-contrib-uglify": "~0.5.0",
"grunt-contrib-watch": "~0.6.1",
"grunt-jsdoc": "^1.1.0",
"karma": "^0.13.22",
"karma-jasmine": "^0.3.7"
}
Now when I run npm install it gives me following errors:
UNMET PEER DEPENDENCY jasmine-core#*
npm WARN EPEERINVALID karma-jasmine#0.3.8 requires a peer of jasmine-core#* but none was installed.
npm WARN EPACKAGEJSON hirebuddy-prototype#0.0.1 No repository field.
hirebuddy-prototype is the name in the package.json.
Will running npm install install all the dependencies mentioned in the package.json or do I need to install jasmine-core and karma-jasmine separately?

This is a weakness in karma-jasmine. In its package.json, jasmine-core is listed as a peerDependency, and NPM 3 no longer installs these automatically. So you have to add jasmine-core in your own package.json. So just npm install jasmine-core --save-dev, and cross your fingers that the latest version is compatible. It should be.
Info: http://blog.npmjs.org/post/110924823920/npm-weekly-5

Related

Can't update to the latest version of cordova-ios

My app, built with Ionic and Cordova, includes the plugin GoogleMaps version 2.6.2 (the most recent), but it has not been loaded on iOS for a month, and Android still works.
I only have taken this product from a colleague and I am a total beginner in terms of Cordova, Ionic and npm. In any case the error is that the plugin is no longer installed (as my console tells me in xCode). When I try to update Cordova-ios to the latest version (ionic cordova platform update ios), I only get the error message
> cordova platform update ios
Using cordova-fetch for cordova-ios#^5.0.0
Failed to fetch platform cordova-ios#^5.0.0
Probably this is either a connection problem, or platform spec is incorrect.
Check your connection and platform name / version / URL.
Error: npm: Command failed with exit code 1 Error output:
npm WARN # ionic-native / google-maps # 3.10.3 requires a peer of # ionic-native / core # ^ 3.6.0 but none is installed. You must install peer dependencies yourself.
npm WARN # ngx-translate / core # 9.1.1 requires a peer of #angular / core #> = 5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN The package # types / node is included as both a dev and production dependency.
npm ERR! path /path/to/app/node_modules/cordova-ios/node_modules/.bin/ios-sim
npm ERR! code EEXIST
npm ERR! Refusing to delete /path/to/app/node_modules/cordova-ios/node_modules/.bin/ios-sim: is outside /path/to/app/node_modules / cordova-ios / node_modules / ios-sim and not a link
npm ERR! File exists: /path/to/app/node_modules/cordova-ios/node_modules/.bin/ios-sim
npm ERR! Move it away, and try again.
npm ERR! A complete log of this can be found in:
npm ERR! /path/to/app/.npm/_logs/2019-05-23T06_41_36_667Z-debug.log
[ERROR] An error occurred while running subprocess cordova.
        
        cordova update ios exited with exit code 1.
        
        Re-running this command with the --verbose flag may provide more information.
What does that mean exactly? I wanted to uninstall the iOS platform (ionic cordova platform remove ios) and add new ones (cordova platform add ios#5.0.0), but already when I uninstall I get the following error:
ionic cordova platform remove ios
> cordova platform remove ios --save
Removing ios from cordova.platforms array in package.json
Error: npm: Command failed with exit code 1 Error output:
npm WARN #ionic-native/google-maps#3.10.3 requires a peer of #ionic-native/core#^3.6.0 but none is installed. You must install peer dependencies yourself.
npm WARN #ngx-translate/core#9.1.1 requires a peer of #angular/core#>=5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN The package #types/node is included as both a dev and production dependency.
npm ERR! path /path/to/app/node_modules/cordova-ios/node_modules/.bin/ios-sim
npm ERR! code EEXIST
npm ERR! Refusing to delete /path/to/app/node_modules/cordova-ios/node_modules/.bin/ios-sim: is outside /path/to/app/node_modules/cordova-ios/node_modules/ios-sim and not a link
npm ERR! File exists: /path/to/app/node_modules/cordova-ios/node_modules/.bin/ios-sim
npm ERR! Move it away, and try again.
npm ERR! A complete log of this run can be found in:
npm ERR! /path/to/app/.npm/_logs/2019-05-23T07_05_52_055Z-debug.log
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-common/src/superspawn.js:125:23)
at ChildProcess.emit (events.js:196:13)
at maybeClose (internal/child_process.js:1011:16)
at Socket.<anonymous> (internal/child_process.js:416:11)
at Socket.emit (events.js:196:13)
at Pipe.<anonymous> (net.js:586:12) {
stderr: 'npm WARN #ionic-native/google-maps#3.10.3 requires a peer of ' +
'#ionic-native/core#^3.6.0 but none is installed. You must install peer ' +
'dependencies yourself.\nnpm WARN #ngx-translate/core#9.1.1 requires a ' +
'peer of #angular/core#>=5.0.0 but none is installed. You must install ' +
'peer dependencies yourself.\nnpm WARN The package #types/node is ' +
'included as both a dev and production dependency.\n\nnpm ERR! path ' +
'/path/to/app/node_modules/cordova-ios/node_modules/.bin/ios-sim\n' +
'npm ERR! code EEXIST\nnpm ERR! Refusing to delete ' +
'/path/to/app/node_modules/cordova-ios/node_modules/.bin/ios-sim: ' +
'is outside ' +
'/path/to/app/node_modules/cordova-ios/node_modules/ios-sim ' +
'and not a link\nnpm ERR! File exists: ' +
'/path/to/app/node_modules/cordova-ios/node_modules/.bin/ios-sim\n' +
'npm ERR! Move it away, and try again.\n\nnpm ERR! A complete log of this ' +
'run can be found in:\nnpm ERR! ' +
'/path/to/app/.npm/_logs/2019-05-23T07_05_52_055Z-debug.log\n',
code: 1
}
[ERROR] An error occurred while running subprocess cordova.
cordova platform remove ios --save exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
I have installed the following plugins:
> cordova plugin ls
cordova-plugin-datepicker 0.9.3 "DatePicker"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-geolocation 4.0.1 "Geolocation"
cordova-plugin-googlemaps 2.6.2 "cordova-plugin-googlemaps"
cordova-plugin-ionic-webview 4.0.1 "cordova-plugin-ionic-webview"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"
cordova-sqlite-storage 2.6.0 "Cordova sqlite storage plugin"
ionic-plugin-keyboard 2.2.1 "Keyboard"
phonegap-plugin-push 1.11.1 "PushPlugin"
What exactly do I have to do to update cordova-ios to the latest version? What else do you need for information that I could give you? My Mac already has the latest operating system.
EDIT:
I ran rm -Rf platforms / node_modules / && npm install && ionic cordova platform add ios # latest and now I get the following output on the console.
> fsevents#1.2.9 install / path / to / app / node_modules / fsevents
> node install
node-pre-gyp WARN Using request for node-pre-gyp https download
[fsevents] Success: "/path/to/app/node_modules/fsevents/lib/binding/Release/node-v72-darwin-x64/fse.node" is installed via remote
> node-sass#4.12.0 install / path / to / app / node_modules / node-sat
> node scripts / install.js
Cached binary found at /path/to/app/.npm/node-sass/4.12.0/darwin-x64-72_binding.node
> uglifyjs-webpack-plugin#0.4.6 postinstall / path / to / app / node_modules / uglifyjs-webpack-plugin
> node lib / post_install.js
> node-sass#4.12.0 postinstall / path / to / app / node_modules / node-sass
> node scripts / build.js
Binary found at /path/to/app/node_modules/node-sass/vendor/darwin-x64-72/binding.node
Testing binary
Binary is fine
npm WARN The package # types / node is included as both a dev and production dependency.
added 1330 packages from 1442 contributors in 63.504s
> cordova platform add ios # latest --save
Using cordova-fetch for cordova-ios # latest
Adding ios project ...
Creating Cordova project for the iOS platform:
Path: platforms / ios
Package: com.gpsno
Name: GPS-No.com
iOS project created with cordova-ios#5.0.1
Installing "cordova-plugin-datepicker" for ios
Installing "cordova-plugin-device" for ios
Installing "cordova-plugin-geolocation" for ios
Installing "cordova-plugin-googlemaps" for ios
"framework" tag with type "podspec" is deprecated and will be removed. Please use the "podspec" tag.
cordova-plugin-googlemaps depends on GoogleMaps # ~> 2.7.0, which conflicts with another plugin. GoogleMaps # ~> 3.1.0 is already installed and was not overwritten.
Running command: pod install --verbose
      Official document https://github.com/mapsplugin/cordova-plugin-googlemaps-doc/blob/master/v2.6.0/README.md Please consider buying beer for us 🍺 https://github.com/mapsplugin/ cordova-plugin-google maps # buy-us-a-beer
    
Installing "cordova-plugin-ionic-webview" for ios
Installing "cordova-plugin-splashscreen" for ios
Installing "cordova-plugin-statusbar" for ios
Installing "cordova-plugin-whitelist" for ios
Installing "cordova-sqlite-storage" for ios
Failed to install 'cordova-sqlite-storage': CordovaError: Using "requireCordovaModule" to load non-cordova module "q" is not supported. Instead, add this module to your dependencies and use regular "require" to load it.
    at Context.requireCordovaModule (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/Context.js:57:15)
    at module.exports (/path/to/app/plugins/cordova-sqlite-storage/scripts/beforePluginInstall.js:13:21)
    at runScriptViaModuleLoader (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:181:32)
    at runScript (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:157:16)
    at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:125:20
    at processTicksAndRejections (internal / process / task_queues.js: 89: 5)
Using "requireCordovaModule" to load non-cordova module "q" is not supported. Instead, add this module to your dependencies and use regular "require" to load it.
[ERROR] An error occurred while running subprocess cordova.
        
        cordova platform add ios # latest --save exited with exit code 1.
        
        Re-running this command with the --verbose flag may provide more information.
It looks like everything had worked out. Do I have to worry about the message
cordova-plugin-googlemaps depends on GoogleMaps # ~> 2.7.0, which conflicts with another plugin. GoogleMaps # ~> 3.1.0 is already installed and was not overwritten.
If so what can I do or remove?
How can I solve the problem
Installing "cordova-sqlite-storage" for ios
Failed to install 'cordova-sqlite-storage': CordovaError: Using "requireCordovaModule" to load non-cordova module "q" is not supported. Instead, add this module to your dependencies and use regular "require" to load it.
Installing "cordova-sqlite-storage" for ios
Failed to install 'cordova-sqlite-storage': CordovaError: Using "requireCordovaModule" to load non-cordova module "q" is not supported. Instead, add this module to your dependencies and use regular "require" to load it.
This is because you have cordova#9.0.0 CLI installed which removed support for use of requireCordovaModule by 3rd party plugins, but you have an old version of cordova-sqlite-storage plugin installed which makes use of requireCordovaModule. So you need to update your version of cordova-sqlite-storage plugin:
cordova plugin rm cordova-sqlite-storage && cordova plugin add cordova-sqlite-storage#latest
cordova-plugin-googlemaps depends on GoogleMaps # ~> 2.7.0, which conflicts with another plugin. GoogleMaps # ~> 3.1.0 is already installed and was not overwritten.
Again probably due to an outdated version of cordova-plugin-googlemaps so update it:
cordova plugin rm cordova-plugin-googlemaps --nosave && cordova plugin add cordova-plugin-googlemaps#latest
Note the use of --nosave option when removing the plugin to preserve any plugin variables containing API keys.
You should also check and update the other plugins in your project. An easy way to do this is using the cordova-check-plugins tool:
npm install -g cordova-check-plugins
cordova-check-plugins --unconstrain-versions --update=auto
# or --update=interactive for interactive update process
Disclaimer: I am the author of cordova-check-plugins
Be aware when updating plugins that major version updates may contain breaking changes to APIs which your app makes use of, so you should be aware of this:
checkout the changelog or commit history of plugins for which you are updating the major version and make any necessary API changes in your app.

Upgrading ngx-bootstrap 3.0.1 to 4.0.1

While Upgrading from ngx bootstrap 3.0.1 to 4.0.1 am getting the following error.Replaced the node_modules, package.json still getting the same errors.
Angular Version :
Angular 6,
Typescript: 2.7.2.
Errors:
ERROR in node_modules/ngx-bootstrap/chronos/utils/type-checks.d.ts(8,62): error TS2304: Cannot find name 'Extract'.
node_modules/ngx-bootstrap/datepicker/reducer/bs-datepicker.actions.d.ts(5,33): error TS1039: Initializers are not allowed in ambient contexts.
node_modules/ngx-bootstrap/timepicker/reducer/bs-datepicker.actions.d.ts(4,33): error TS1039: Initializers are not allowed in ambient contexts.
Errors in the image
I have encounter this error when I was using ngx-editor to implement rich text editor in Angular
This error occurs due to older version of Angular and rxjs, In my case I was using Angular 6 and rxjs 6.0.0, then I have updated it to Angular 7 and rxjs 6.2.0 by using below commands (Typescript will also be updated to typescript 2.9.2)
ng update rxjs#~6.2.0
ng update #angular/cli #angular/core
Note: If you are getting below warning
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
and you want to ignore this warning (fsevents#1.2.7:) you can use below command
npm i -f
After this, I have uninstall ngx-bootstrap and ngx-editor, then first install dependency packages and then reinstall ngx-bootstrap and ngx-editor, as mentioned below steps.
npm i ajv#^6.9.1 --save
npm i font-awesome#^4.7.0 --save
npm i angular-font-awesome
npm install ngx-bootstrap --save
npm install ngx-editor --save
At last, you need to check if HttpClientModule and other packages are properly imported in app.module.ts
import { NgxEditorModule } from 'ngx-editor';
import { AngularFontAwesomeModule } from 'angular-font-awesome';
import { TooltipModule } from 'ngx-bootstrap/tooltip';
import { HttpClientModule } from '#angular/common/http';
imports: [
BrowserModule,
AppRoutingModule,
NgxEditorModule,
AngularFontAwesomeModule,
TooltipModule.forRoot(),
HttpClientModule
],
Now it is resolved, In addition you can able to use rich text editor by using ngx-editor
Thanks
the Solution for this error is the same to the above, change the followings versions in package.json.
"bootstrap": "4.1.3",
"font-awesome": "4.7.0",
"ngx-bootstrap": "3.1.1",
"ngx-editor": "4.0.0",
"rxjs": "6.3.3",
remove the node_module and package-lock.json and than install npm:
npm install.
Fix it in files
"\node_modules\ngx-bootstrap\datepicker\reducer\bs-datepicker.actions.d.ts"
From
static readonly CALCULATE = "[datepicker] calculate dates matrix";
To
static readonly CALCULATE : "[datepicker] calculate dates matrix";
Solution for this error is change the Bootstrap version (4.0.0 to 3.0.0) and remove the ^ in package.json (i.e "rxjs": "^6.0.0" to "rxjs": "6.0.0", and "rxjs-compat": "^6.2.2" to "rxjs-compat": "6.2.2",).
if you want bootstrap 4 version than try to change the rxjs and rxjs-compat (As i inform in above line).and remove the node_module and package-lock.json and than install npm.

can polymer-cli#next damaged somehow polymer 1

Until I started the new polymer-cli my projects done in Polymer 1 was running as expected. Now, when I tried to start them via gulp serve I get error.
I tried updated by "bower update" and I got
bower polymer#1.11.3 ENOENT ENOENT: no such file or directory, lstat 'C:\Users\my-user\AppData\Local\Temp\tmp-28649quOp0xfcp3e\polymer-1.11.3'
Stack trace:
C:\Users\my-user\AppData\Roaming\npm\node_modules\bower\lib\node_modules\fstream\lib\dir-reader.js:96:25
C:\Users\my-user\AppData\Roaming\npm\node_modules\bower\lib\node_modules\graceful-fs\polyfills.js:284:29
FSReqWrap.oncomplete (fs.js:152:21)
Console trace:
Error
at StandardRenderer.error (C:\Users\my-user\AppData\Roaming\npm\node_modules\bower\lib\renderers\StandardRenderer.js:88:37)
at Logger.<anonymous> (C:\Users\my-user\AppData\Roaming\npm\node_modules\bower\lib\bin\bower.js:113:30)
at emitOne (events.js:116:13)
at Logger.emit (events.js:211:7)
at Logger.emit (C:\Users\my-user\AppData\Roaming\npm\node_modules\bower\lib\node_modules\bower-logger\lib\Logger.js:29:39)
at C:\Users\my-user\AppData\Roaming\npm\node_modules\bower\lib\commands\index.js:49:24
at _rejected (C:\Users\my-user\AppData\Roaming\npm\node_modules\bower\lib\node_modules\q\q.js:864:24)
at C:\Users\my-user\AppData\Roaming\npm\node_modules\bower\lib\node_modules\q\q.js:890:30
at Promise.when (C:\Users\my-user\AppData\Roaming\npm\node_modules\bower\lib\node_modules\q\q.js:1142:31)
at Promise.promise.promiseDispatch (C:\Users\my-user\AppData\Roaming\npm\node_modules\bower\lib\node_modules\q\q.js:808:41)
System info:
Bower version: 1.8.4
Node version: 8.11.1
OS: Windows_NT 6.1.7601 x64
Could that be related to the fact I installed "npm install -g polymer-cli#next"? What could I check around?

Package.json syntax error?

I'm trying to run npm install and I get this:
root#WF-DEV1:/var/www/laravel# npm install
npm ERR! install Couldn't read dependencies
npm ERR! Failed to parse json
npm ERR! Unexpected token }
npm ERR! File: /var/www/laravel/package.json
npm ERR! Failed to parse package.json data.
npm ERR! package.json must be actual JSON, not just JavaScript.
npm ERR!
npm ERR! This is not a bug in npm.
npm ERR! Tell the package author to fix their package.json file. JSON.parse
This is my package.json file:
{
"name": "bootstrap-tagsinput",
"title": "Bootstrap Tags Input",
"version": "0.5.0",
"description": "jQuery plugin providing a Twitter Bootstrap user interface for managing tags.",
"scripts": {
"test": "karma start --single-run --no-auto-watch"
},
"main" : "dist/bootstrap-tagsinput.js",
"repository": {
"type": "git",
"url": "git://github.com/timschlechter/bootstrap-tagsinput.git"
},
"author": "Tim Schlechter",
"contributors": [{
"name": "Luckner Jr Jean-Baptiste"
}],
"license": "MIT",
"homepage": "http://timschlechter.github.io/bootstrap-tagsinput/examples/",
"download": "http://timschlechter.github.io/bootstrap-tagsinput/build/bootstrap-tagsinput.zip",
"keywords": [
"tags",
"bootstrap",
"input",
"select",
"form"
],
"readmeFilename": "README.md",
"devDependencies": {
"grunt": "~0.4.1",
"grunt-cli": "~0.1.13",
"grunt-contrib-copy": "~0.5.0",
"grunt-contrib-uglify": "~0.2.2",
"grunt-jquerymanifest": "~0.1.4",
"grunt-zip": "~0.15.0",
"karma": "~0.12.19",
"phantomjs": "~1.9.7-15",
"karma-phantomjs-launcher": "~0.1.3",
"karma-jasmine": "~0.1.5",
"grunt-karma": "~0.8.3",
"bower": "~1.3.8",
"grunt-bower-task": "~0.4.0"
},
"banner": "/*\n * <%= pkg.name %> v<%= pkg.version %> by <%= pkg.author %>\n * <%= pkg.license.url %>\n */\n"
}
Any help would be appreciated!
The JSON appears to be valid (I ran it through an online parser). I ran the same package.json under windows and got the following output:
D:\workspace\deleteme>npm install
npm ERR! install Couldn't read dependencies
npm ERR! Windows_NT 10.0.10240
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v4.1.1
npm ERR! npm v2.14.4
npm ERR! file D:\workspace\deleteme\package.json
npm ERR! code EJSONPARSE
npm ERR! Failed to parse json
npm ERR! Unexpected token '<' at 1:1
npm ERR! <!DOCTYPE html>
npm ERR! ^
npm ERR! File: D:\workspace\deleteme\package.json
npm ERR! Failed to parse package.json data.
npm ERR! package.json must be actual JSON, not just JavaScript.
npm ERR!
npm ERR! This is not a bug in npm.
npm ERR! Tell the package author to fix their package.json file. JSON.parse
npm ERR! Please include the following file with any support request:
npm ERR! D:\workspace\deleteme\npm-debug.log
The npm-debug.log started with:
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 'install' ]
2 info using npm#2.14.4
3 info using node#v4.1.1
4 verbose readDependencies loading dependencies from D:\workspace\deleteme\package.json
5 error install Couldn't read dependencies
6 verbose stack Error: Failed to parse json
6 verbose stack Unexpected token '<' at 1:1
6 verbose stack <!DOCTYPE html>
6 verbose stack ^
6 verbose stack at parseError (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:379:11)
6 verbose stack at parseJson (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:68:23)
6 verbose stack at C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:48:5
6 verbose stack at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:76:16
6 verbose stack at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:380:3)
7 verbose cwd D:\workspace\deleteme
So on a hunch, I changed your devDependencies to dependencies and that worked. So I don't have a firm answer, but it seems there is definitely something in your file that npm has a problem with - it's just not a JSON error.
For some reason, the wrong code was in my package.json. Not sure how it got there but I definitely didn't put it there. I reinstalled everything and it's now fixed and the right code is in there now.

npm install error - invalid package.json

I'm using this tutorial to understand implementing oauth2 in Node.js.
This is my package.json:
{
"name": "application-name",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "coffee -w server.coffee"
},
"dependencies": {
"express": "3.3.4",
"jade": "*",
"coffee-script": "latest",
"passport-http": "latest",
"passport-http-bearer": "latest",
"passport-oauth2-client-password": "latest",
"oauth2orize": "latest",
"debug" "~0.7.2"
}
}
I'm getting the error:
npm ERR! install Couldn't read dependencies
npm ERR! Failed to parse json
npm ERR! Unexpected string
npm ERR! File: /Users/jashua/Desktop/auth/package.json
npm ERR! Failed to parse package.json data.
npm ERR! package.json must be actual JSON, not just JavaScript.
npm ERR!
npm ERR! This is not a bug in npm.
npm ERR! Tell the package author to fix their package.json file. JSON.parse
npm ERR! System Darwin 12.3.0
npm ERR! command "node" "/usr/local/bin/npm" "install"
npm ERR! cwd /Users/jashua/Desktop/auth
npm ERR! node -v v0.10.15
npm ERR! npm -v 1.3.5
npm ERR! file /Users/jashua/Desktop/auth/package.json
npm ERR! code EJSONPARSE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/me/Desktop/auth/npm-debug.log
npm ERR! not ok code 0
Any ideas what's wrong with my package.json?
The error means exactly what it states, the JSON in your package.json is not valid and can't be parsed properly. Change "debug" "~0.7.2" to "debug": "~0.7.2".
Use this command to fix package.json related issue.
npm cache clean
C:\Program Files\nodejs>npm cache verify
Fixes it on Windows 10, run it with an Administrator command prompt Window.
I arrived at this page due to the same npm error, but a different cause. After viewing the log files, I realized that npm did not like my comment on the top line of the file.
// package.json
{ ...
}
After removing all comments, npm ran through everything beautifully. My comment was not necessary, so I'm fine as it is. But if you require comments within your xml, see How do I add comments to package.json for npm install?
I had the same issue caused by changes that I had made to my package.json file. I just reverted to my backup version of the package.json file. I attached that below if anyone else needs one:
{"name": "OpenShift-Sample-App",
"version": "1.0.0",
"description": "OpenShift Sample Application",
"keywords": [
"OpenShift",
"Node.js",
"application",
"openshift"
],
"author": {
"name": "OpenShift",
"email": "ramr#example.org",
"url": "http://www.openshift.com/"
},
"homepage": "http://www.openshift.com/",
"repository": {
"type": "git",
"url": "https://github.com/openshift/origin-server"
},
"engines": {
"node": ">= 0.6.0",
"npm": ">= 1.0.0"
},
"dependencies": {
"express": "~3.4.4"
},
"devDependencies": {},
"bundleDependencies": [],
"private": true,
"main": "server.js"
}
Sometimes you might have some weird unicode chars in your package.json. For example you might have \u00A0 (unicode non-breaking space) instead of a space somewhere. It looks the same in editor, so beware.
(I just had such problem after copying a small piece of config from a blog.)
My project was in D:\wwwroot\Projetos 2017\Android\PluginTest\PluginTest\plugins\cordova-plugin-iservice
The problem is space between Projetos(here)2017
I removed space to:
D:\wwwroot\Projetos2017\Android\PluginTest\PluginTest\plugins\cordova-plugin-iservice
and Work fine