Closed Dayjo closed 7 years ago
Just as a side note, I wanted to try and build it myself with a fix, but when I run npm run start
or npm run dev
, I get the following response;
> google-trends-api@4.0.0 start /google-trends/node_modules/google-trends-api
> npm run dev
> google-trends-api@4.0.0 dev /google-trends/node_modules/google-trends-api
> webpack --progress --colors --watch --mode=dev
Hash: cbb9eab0f38384aa33b7
Version: webpack 1.12.9
Time: 55ms
+ 1 hidden modules
ERROR in ./src/index.js
Module parse failed: /google-trends/node_modules/google-trends-api/src/index.js Line 3: Unexpected token
You may need an appropriate loader to handle this file type.
| 'use strict';
|
| import api from './api';
|
| export default {
Feel free to laugh if I've done something stupid ^_^ ( I did run npm install )
Hmm, what version of node are you using?
Looks like I'm on 6.7.0
I can try updating to the latest LTS 6.9.5
.
Edit; updated, and getting the exact same errors.
Should work on 6.7.0
must be something else...
Have tried from scratch again (still on 6.9.5 now);
mkdir google-trends-test
cd google-trends-test
Install (it's going up a directory because I don't have a package.json, I also tried it with one so it installs in this directory)
npm install google-trends-api
/Users/joelday/Sites
└── google-trends-api@4.0.0
npm WARN enoent ENOENT: no such file or directory, open '/Users/joelday/Sites/package.json'
npm WARN Sites No description
npm WARN Sites No repository field.
npm WARN Sites No README data
npm WARN Sites No license field.
nano example.js
Put in;
const googleTrends = require('google-trends-api');
googleTrends.interestOverTime({keyword: 'Women\'s march'})
.then(function(results){
console.log('These results are awesome', results);
})
.catch(function(err){
console.error('Oh no there was an error', err);
});
node example.js
Exact same error :( let me know if there's anything else I can try.
Ah not sure why it's not working, I'll have to poke around a bit later. Maybe try and change the package.json
main
key to lib/google-trends-api.js
rather than lib/google-trends-api.min.js
on the downloaded node module
@Dayjo Ok, so I forgot to npm run build
before deploying. 😬 Should work now in v4.0.1
Hehe whoops!
Works a treat! :) Time to bombard it requests.
Hello!
Just running the example code;
Getting the following error;
I'm assuming it's something to do with;