Closed cozyrobinson closed 5 years ago
Hi @cozyrobinson, thank you for opening this issue 👍
I am not very proficient with Angular on particular but it seems that this is not directly related to the traveler package itself. At least this is what I would assume by the error log you provided.
Do you have any code or repository which is a minimal reproducible example, where you can show the error ? So basically which I can clone and test locally on my machine ?
Thanks for responding!
I use bitbucket, if that's okay: https://bitbucket.org/drift_cody/testiny/overview
Sure, Bitbucket is not a problem. But it seems your repository does not contain any code ?
Oops, try now.
Thanks a lot for the code
I checked your project and you are right, with the-traveler
as a dependency it doesn't compile. At first I was a little bit confused but then I quickly realised what's the problem here. I am sorry that I did not thought of it on the first place.
The dependencies of the the-travler
are depend on a Node environment. For example the fs
module which will give you access to the file system. It is used to interact with the manifest files. But the angular-cli
will create a browser application which does not run in a Node environment. That is why you get all those errors of modules not being found while compiling. They are simply not available in the browser. For reference see this comment: https://github.com/angular/angular-cli/issues/8272#issuecomment-341428996
So you are only able to use the library in a Node environment.
Ah, bummer. So there's no way at all to run this with my project?
On Sun, Nov 18, 2018, 2:01 PM Alexander Weiß <notifications@github.com wrote:
Thanks a lot for the code
I checked your project and you are right, with the-traveler as a dependency it doesn't compile. At first I was a little bit confused but then I quickly realised what's the problem here. I am sorry that I did not thought of it on the first place.
The dependencies of the the-travler are depend on a Node environment. For example the fs module which will give you access to the file system. It is used to interact with the manifest files. But the angular-cli will create a browser application which does not run in a Node environment. That is why you get all those errors of modules not being found while compiling. They are simply not available in the browser. For reference see this comment: angular/angular-cli#8272 (comment) https://github.com/angular/angular-cli/issues/8272#issuecomment-341428996
So you are only able to use the library in a Node environment.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/alexanderwe/the-traveler/issues/37#issuecomment-439721168, or mute the thread https://github.com/notifications/unsubscribe-auth/Aq-AfVr_APAe8ZOrZ56aSHK2R7kqJMziks5uwbyygaJpZM4YfASC .
I am really sorry to say this, but if you want to use it as a browser module - no. Unfortunately there is now way to use it since it relies on other modules which are only available in a Node environment.
What you could do, is set up a Node server, which is running the library and expose it results trough an API but I think this is not what you want to do. Just a thought that came into my mind.
I will close this issue for now. If you still have some other doubts or questions please do not hesitate to ask
I'm a front end web developer (mostly html/css/js/php) and I decided to dive into Node.js/Angular, so I'm definitely doing something wrong, there's no doubt about it. I'm just hoping somebody can help.
Any time I add this to app.component.ts: `import Traveler from 'the-traveler'; import { ComponentType } from 'the-traveler/build/enums';
const traveler = new Traveler({ apikey: 'pasteYourAPIkey', userAgent: 'yourUserAgent', //used to identify your request to the API });`
It fails to compile, and I get this in cmd: `ERROR in ./node_modules/aws-sign2/index.js Module not found: Error: Can't resolve 'crypto' in 'D:\Coding\BitBucket\testiny\node_modules\aws-sign2' ERROR in ./node_modules/aws4/aws4.js Module not found: Error: Can't resolve 'crypto' in 'D:\Coding\BitBucket\testiny\node_modules\aws4' ERROR in ./node_modules/ecc-jsbn/index.js Module not found: Error: Can't resolve 'crypto' in 'D:\Coding\BitBucket\testiny\node_modules\ecc-jsbn' ERROR in ./node_modules/http-signature/lib/signer.js Module not found: Error: Can't resolve 'crypto' in 'D:\Coding\BitBucket\testiny\node_modules\http-signature\lib' ERROR in ./node_modules/http-signature/lib/verify.js Module not found: Error: Can't resolve 'crypto' in 'D:\Coding\BitBucket\testiny\node_modules\http-signature\lib' ERROR in ./node_modules/oauth-sign/index.js Module not found: Error: Can't resolve 'crypto' in 'D:\Coding\BitBucket\testiny\node_modules\oauth-sign' ERROR in ./node_modules/request/lib/helpers.js Module not found: Error: Can't resolve 'crypto' in 'D:\Coding\BitBucket\testiny\node_modules\request\lib' ERROR in ./node_modules/request/lib/hawk.js Module not found: Error: Can't resolve 'crypto' in 'D:\Coding\BitBucket\testiny\node_modules\request\lib' ERROR in ./node_modules/request/lib/oauth.js Module not found: Error: Can't resolve 'crypto' in 'D:\Coding\BitBucket\testiny\node_modules\request\lib' ERROR in ./node_modules/sshpk/lib/key.js Module not found: Error: Can't resolve 'crypto' in 'D:\Coding\BitBucket\testiny\node_modules\sshpk\lib' ERROR in ./node_modules/sshpk/lib/dhe.js Module not found: Error: Can't resolve 'crypto' in 'D:\Coding\BitBucket\testiny\node_modules\sshpk\lib' ERROR in ./node_modules/sshpk/lib/certificate.js Module not found: Error: Can't resolve 'crypto' in 'D:\Coding\BitBucket\testiny\node_modules\sshpk\lib' ERROR in ./node_modules/sshpk/lib/signature.js Module not found: Error: Can't resolve 'crypto' in 'D:\Coding\BitBucket\testiny\node_modules\sshpk\lib' ERROR in ./node_modules/sshpk/lib/fingerprint.js Module not found: Error: Can't resolve 'crypto' in 'D:\Coding\BitBucket\testiny\node_modules\sshpk\lib' ERROR in ./node_modules/sshpk/lib/identity.js Module not found: Error: Can't resolve 'crypto' in 'D:\Coding\BitBucket\testiny\node_modules\sshpk\lib' ERROR in ./node_modules/sshpk/lib/utils.js Module not found: Error: Can't resolve 'crypto' in 'D:\Coding\BitBucket\testiny\node_modules\sshpk\lib' ERROR in ./node_modules/sshpk/lib/private-key.js Module not found: Error: Can't resolve 'crypto' in 'D:\Coding\BitBucket\testiny\node_modules\sshpk\lib' ERROR in ./node_modules/sshpk/lib/formats/pem.js Module not found: Error: Can't resolve 'crypto' in 'D:\Coding\BitBucket\testiny\node_modules\sshpk\lib\formats' ERROR in ./node_modules/sshpk/lib/formats/ssh-private.js Module not found: Error: Can't resolve 'crypto' in 'D:\Coding\BitBucket\testiny\node_modules\sshpk\lib\formats' ERROR in ./node_modules/sshpk/lib/formats/openssh-cert.js Module not found: Error: Can't resolve 'crypto' in 'D:\Coding\BitBucket\testiny\node_modules\sshpk\lib\formats' ERROR in ./node_modules/node-stream-zip/node_stream_zip.js Module not found: Error: Can't resolve 'fs' in 'D:\Coding\BitBucket\testiny\node_modules\node-stream-zip' ERROR in ./node_modules/request/lib/har.js Module not found: Error: Can't resolve 'fs' in 'D:\Coding\BitBucket\testiny\node_modules\request\lib' ERROR in ./node_modules/the-traveler/build/Traveler.js Module not found: Error: Can't resolve 'fs' in 'D:\Coding\BitBucket\testiny\node_modules\the-traveler\build' ERROR in ./node_modules/forever-agent/index.js Module not found: Error: Can't resolve 'http' in 'D:\Coding\BitBucket\testiny\node_modules\forever-agent' ERROR in ./node_modules/http-signature/lib/signer.js Module not found: Error: Can't resolve 'http' in 'D:\Coding\BitBucket\testiny\node_modules\http-signature\lib' ERROR in ./node_modules/request/request.js Module not found: Error: Can't resolve 'http' in 'D:\Coding\BitBucket\testiny\node_modules\request' ERROR in ./node_modules/tunnel-agent/index.js Module not found: Error: Can't resolve 'http' in 'D:\Coding\BitBucket\testiny\node_modules\tunnel-agent' ERROR in ./node_modules/forever-agent/index.js Module not found: Error: Can't resolve 'https' in 'D:\Coding\BitBucket\testiny\node_modules\forever-agent' ERROR in ./node_modules/request/request.js Module not found: Error: Can't resolve 'https' in 'D:\Coding\BitBucket\testiny\node_modules\request' ERROR in ./node_modules/tunnel-agent/index.js Module not found: Error: Can't resolve 'https' in 'D:\Coding\BitBucket\testiny\node_modules\tunnel-agent' ERROR in ./node_modules/forever-agent/index.js Module not found: Error: Can't resolve 'net' in 'D:\Coding\BitBucket\testiny\node_modules\forever-agent' ERROR in ./node_modules/tough-cookie/lib/cookie.js Module not found: Error: Can't resolve 'net' in 'D:\Coding\BitBucket\testiny\node_modules\tough-cookie\lib' ERROR in ./node_modules/tunnel-agent/index.js Module not found: Error: Can't resolve 'net' in 'D:\Coding\BitBucket\testiny\node_modules\tunnel-agent' ERROR in ./node_modules/mime-types/index.js Module not found: Error: Can't resolve 'path' in 'D:\Coding\BitBucket\testiny\node_modules\mime-types' ERROR in ./node_modules/node-stream-zip/node_stream_zip.js Module not found: Error: Can't resolve 'path' in 'D:\Coding\BitBucket\testiny\node_modules\node-stream-zip' ERROR in ./node_modules/assert-plus/assert.js Module not found: Error: Can't resolve 'stream' in 'D:\Coding\BitBucket\testiny\node_modules\assert-plus' ERROR in ./node_modules/combined-stream/lib/combined_stream.js Module not found: Error: Can't resolve 'stream' in 'D:\Coding\BitBucket\testiny\node_modules\combined-stream\lib' ERROR in ./node_modules/delayed-stream/lib/delayed_stream.js Module not found: Error: Can't resolve 'stream' in 'D:\Coding\BitBucket\testiny\node_modules\delayed-stream\lib' ERROR in ./node_modules/isstream/isstream.js Module not found: Error: Can't resolve 'stream' in 'D:\Coding\BitBucket\testiny\node_modules\isstream' ERROR in ./node_modules/node-stream-zip/node_stream_zip.js Module not found: Error: Can't resolve 'stream' in 'D:\Coding\BitBucket\testiny\node_modules\node-stream-zip' ERROR in ./node_modules/request/request.js Module not found: Error: Can't resolve 'stream' in 'D:\Coding\BitBucket\testiny\node_modules\request' ERROR in ./node_modules/sshpk/lib/ed-compat.js Module not found: Error: Can't resolve 'stream' in 'D:\Coding\BitBucket\testiny\node_modules\sshpk\lib' ERROR in ./node_modules/forever-agent/index.js Module not found: Error: Can't resolve 'tls' in 'D:\Coding\BitBucket\testiny\node_modules\forever-agent' ERROR in ./node_modules/tunnel-agent/index.js Module not found: Error: Can't resolve 'tls' in 'D:\Coding\BitBucket\testiny\node_modules\tunnel-agent' ERROR in ./node_modules/node-stream-zip/node_stream_zip.js Module not found: Error: Can't resolve 'zlib' in 'D:\Coding\BitBucket\testiny\node_modules\node-stream-zip' ERROR in ./node_modules/request/request.js Module not found: Error: Can't resolve 'zlib' in 'D:\Coding\BitBucket\testiny\node_modules\request' i 「wdm」: Failed to compile.
ERROR in src/app/app.component.ts(3,1): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try
npm i @types/node
. src/app/app.component.ts(4,19): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Trynpm i @types/node
.`Now if I'm putting it in the wrong place, let me know. I'm pretty new at this. And yes, I do have an API key.
Any help would be very appreciated.