newrelic / newrelic-cordova-plugin

A Cordova plugin for the New Relic Mobile SDKs
Apache License 2.0
18 stars 66 forks source link

Cannot add plugin after upgrading cordova 11 to 12 #76

Closed yqian-eab closed 9 months ago

yqian-eab commented 1 year ago

After upgrading Cordova version from 11 to 12, running cordova prepare or cordova plugin add https://github.com/newrelic/newrelic-cordova-plugin.git --variable IOS_APP_TOKEN="{ios-app-token}" --variable ANDROID_APP_TOKEN="{android-app-token}" exactly as instructed in the documentation results in the following error message Failed to fetch plugin https://github.com/newrelic/newrelic-cordova-plugin.git via registry. Probably this is either a connection problem, or plugin spec is incorrect. Check your connection and plugin name/version/URL. CordovaError: Error: Command failed with exit code 1: npm install https://github.com/newrelic/newrelic-cordova-plugin.git --save-dev

There seems to be a problem with npm install. Running npm install https://github.com/newrelic/newrelic-cordova-plugin.git --save-dev gives me the same error, adding the --legacy-peer-deps flag, however, installs the plugin successfully. Anyone know which change between cordova 11 and 12 caused this to happen and any solutions?

ndesai-newrelic commented 1 year ago

@yqianeab can you share more info about this? I am unable to reproduce this issue from our side.

yqian-eab commented 1 year ago

this is the complete error message

Failed to fetch plugin https://github.com/newrelic/newrelic-cordova-plugin.git via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
CordovaError: Error: Command failed with exit code 1: npm install https://github.com/newrelic/newrelic-cordova-plugin.git --save-dev
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: babel-loader@7.0.0
npm ERR! Found: webpack@1.15.0
npm ERR! node_modules/webpack
npm ERR!   peer webpack@"^1.0.0 || ^2.0.0 || ^3.0.0" from webpack-dev-middleware@1.12.2
npm ERR!   node_modules/webpack-dev-middleware
npm ERR!     webpack-dev-middleware@"^1.10.2" from webpack-dev-server@1.16.5
npm ERR!     node_modules/webpack-dev-server
npm ERR!       dev webpack-dev-server@"1.x.x" from the root project
npm ERR!   peer webpack@">=1.3.0 <3" from webpack-dev-server@1.16.5
npm ERR!   node_modules/webpack-dev-server
npm ERR!     dev webpack-dev-server@"1.x.x" from the root project
npm ERR!   2 more (webpack-stream, the root project)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer webpack@"2" from babel-loader@7.0.0
npm ERR! node_modules/babel-loader
npm ERR!   dev babel-loader@"7.0.0" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: webpack@2.7.0
npm ERR! node_modules/webpack
npm ERR!   peer webpack@"2" from babel-loader@7.0.0
npm ERR!   node_modules/babel-loader
npm ERR!     dev babel-loader@"7.0.0" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
ndesai-newrelic commented 1 year ago

@yqianeab can you share your package.json file? it looks like related dependency on other packages.