You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried copying you "full example" into a .js file i called test-clap.js and tried running it but get the following error message. I also changed the first line from "import ClapDetector from 'clap-detector'" to "const ClapDetector = require('clap-detector')". I am new to node and hope this is a beginner mistake.
TypeError: ClapDetector is not a constructor
at Object. (/home/watson/watson/test-clap/test-clap.js:4:14)
at Module._compile (internal/modules/cjs/loader.js:654:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
at Module.load (internal/modules/cjs/loader.js:566:32)
at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
at Function.Module._load (internal/modules/cjs/loader.js:498:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:695:10)
at startup (internal/bootstrap/node.js:201:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:516:3)
the node_modules folder is in the same directory as ~/watson
I am running node version v9.11.2
strangely, it works when running your demo program as follows:
sudo node node_modules/clap-detector/lib/demo.js
The text was updated successfully, but these errors were encountered:
Dear tom-s,
I tried copying you "full example" into a .js file i called test-clap.js and tried running it but get the following error message. I also changed the first line from "import ClapDetector from 'clap-detector'" to "const ClapDetector = require('clap-detector')". I am new to node and hope this is a beginner mistake.
~/watson/test-clap $ sudo node test-clap.js
/home/watson/watson/test-clap/test-clap.js:4
const clap = new ClapDetector()
^
TypeError: ClapDetector is not a constructor
at Object. (/home/watson/watson/test-clap/test-clap.js:4:14)
at Module._compile (internal/modules/cjs/loader.js:654:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
at Module.load (internal/modules/cjs/loader.js:566:32)
at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
at Function.Module._load (internal/modules/cjs/loader.js:498:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:695:10)
at startup (internal/bootstrap/node.js:201:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:516:3)
the node_modules folder is in the same directory as ~/watson
I am running node version v9.11.2
strangely, it works when running your demo program as follows:
sudo node node_modules/clap-detector/lib/demo.js
The text was updated successfully, but these errors were encountered: