Skip to content
This repository was archived by the owner on May 24, 2023. It is now read-only.

Commit 85b86b9

Browse files
authored
Merge pull request #307 from pycom/develop
new release (npm install at runtime fix)
2 parents cb621d3 + b68c2fc commit 85b86b9

File tree

3 files changed

+702
-1388
lines changed

3 files changed

+702
-1388
lines changed

lib/main.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@ export default {
99
config: Config.settings(),
1010

1111
activate(state) {
12+
try {
13+
require('serialport');
14+
} catch (err) {
15+
if (err.code === 'MODULE_NOT_FOUND') {
16+
console.log('serialport not installed. Installing...');
17+
require('child_process').execSync('npm install serialport');
18+
console.log('Installed serialport!');
19+
}
20+
}
1221

1322
const _this = this;
1423
this.prepareSerialPort(error => {

0 commit comments

Comments
 (0)