Cordova-plugin-bluetooth-serial breaks project on install. (noob question) (answered)


#1

I’m new here. That said, I can’t find a copy of this question, and I think it’s a pretty basic, “Hey, this is broken and I don’t know how to fix it,” kinda thing. I apologize if it is a duplicate.

I’m working with a Windows 7 Pro machine. I have NPM installed. I have Ionic installed. I have run the basic tutorial / startup stuff, and gotten it working. I want to work with a bluetooth device, so I ran the following line:
ionic start [projectname]

I say ‘Y’ to integrating cordova, because I want it. So it runs the next step I planned on running on its own:
ionic integrations enable cordova --quiet

I then run these two lines of code:
ionic cordova plugin add cordova-plugin-bluetooth-serial
npm install --save @ionic-native/bluetooth-serial

And try to go into the directory [projectname] and run:
ionic serve

I get this in response, all three times I’ve followed the instructions:

Error: Cannot find module '[projdir]\node_modules@ionic\app-scripts’
at Function.Module._resolveFilename (module.js:536:15)
at Function.Module._load (module.js:466:25)
at Module.require (module.js:579:17)
at require (internal/module.js:11:18)
at Object. ([userdir]npm\node_modules\io
nic\node_modules@ionic\cli-utils\lib\ionic-angular\app-scripts.js:9:16)
at Generator.next ()
at [userdir]\npm\node_modules\ionic\node_modules\tsl
ib\tslib.js:105:75
at new Promise ()
at Object.__awaiter ([userdir]\npm\node_modules\ioni
c\node_modules\tslib\tslib.js:101:16)
at Object.importAppScripts ([userdir]\npm\node_modul
es\ionic\node_modules@ionic\cli-utils\lib\ionic-angular\app-scripts.js:7:20)

I have reinstalled NPM. I have installed updates to Ionic. I updated TypeScript. I’ve searched for a place where this package was linked to this error was commented on. I’m not sure where to go to do my due diligence, but I have this problem and would like to know how to fix it. I guess there might be some basic dependency debugging links I could dig up, but… It seems a standard, simple line of actions that should all fit together.

Help? Hints? Starter guides I should read beyond the first twenty pages I’ve looked at?

Note: upon running an ‘npm install’ command in the directory, the application now serves properly. It would be nice to know when I need to run this install, I think. But more than that it seems the docs are a little off when it comes to describing addition of packages into a project. I followed instructions and still needed to put a bunch more stuff into my project.

Thanks,
Dylan.


#2

Would you have a try with the command “npm install @ionic/app-scripts@latest”


#3

I’d delete this if you hadn’t already answered it. I dug around a little and found this:


on Github.

I ran an ‘npm install’ and the project now works.


#4

I had the same experience with you some days ago:laughing: