nparashuram / cordova-plugin-browsersync

BrowserSync Plugin for Cordova
110 stars 69 forks source link

cordova-plugin-browsersync breaks literally *everything*. #49

Closed alectrocute closed 6 years ago

alectrocute commented 6 years ago

Love this plugin, but had a nightmare experience with it where it directly forced me to uninstall/reinstall Node.js/npm multiple times via brew. I was up until 4am last night dealing with it, all while trying to meet a deadline. I'd love to help fix the error, but for now, I'm just doing my due diligence to report it.

It's all related to npm's "ansistyles".

After installing cordova-plugin-browsersync, all it takes is attempting to cordova run, etc. for all hell to break loose.

alec:BLEapp alec$ cordova platform add browser
Using cordova-fetch for cordova-browser@~5.0.1
(node:1113) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): CordovaError: Failed to fetch platform cordova-browser@~5.0.1
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 254 Error output:
npm WARN ble.app.alec@1.0.0 No repository field.

npm ERR! path /Users/alec/Desktop/BLEapp/node_modules/npm/node_modules/ansistyles
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename '/Users/alec/Desktop/BLEapp/node_modules/npm/node_modules/ansistyles' -> '/Users/alec/Desktop/BLEapp/node_modules/npm/node_modules/.ansistyles.DELETE'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
(node:1113) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
alec:BLEapp alec$ cordova run -- -live-reload
(node:1118) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): CordovaError: No platforms added to this project. Please use `cordova platform add <platform>`.
(node:1118) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

After recieving this error, it breaks pretty much anything related to installing from npm, Cordova, etc. I tried reinstall "ansistyles", etc. to no avail.

For anybody else having this issue, reinstall node via brew a few times. It does the trick.

I'm on macOS 10.13.2.

Have a great day!

axemclion commented 6 years ago

If you have a PR to fix it, that would be awesome !!

much-rebel commented 6 years ago

Have the same problem, macOS High Sierra Version 10.13.3. Reinstalling node doesn't help. There are 20 plugins more in my project, but only this breaks the things. Bug appears after upgrading cordova to higher than 6.4.0.

node v9.4.0 npm 5.6.0