Temasys / AdapterJS

AdapterJS Javascript Polyfill and Tools for WebRTC - Skylink WebRTC
http://skylink.io/web
Other
429 stars 100 forks source link

Error: module "./utils" not found from "***adapter.min.js" #238

Closed dongkai1993-zz closed 7 years ago

dongkai1993-zz commented 7 years ago

Hi! I couldn't found 'utils' anywhere.

johache commented 7 years ago

Hi,

Could you give us a little more details on what you are doing ?

dongkai1993-zz commented 7 years ago

adapter.debug.js line 1158, var logging = require('./utils').log;

can't use gulp-browserify

johache commented 7 years ago

Hum, that weird.

May I know how you are using AJS ? Are you including our CDN file, or using it as an npm dep ?

utils should be defined in you version of AJS (in my case, it is at line 3151) Is there any chance that you didn't run npm install ?

dongkai1993-zz commented 7 years ago

I get AJS from /publish/adapter.debug.js. the version is: /*! adapterjs - v0.14.0 - 2016-10-03 */ I want to develop it in node,and use gulp-browserify to run in browser. A few months ago, AJS without require('./utils')

johache commented 7 years ago

I don't get that issue when I try on my side... Can you produce an code example that reproduces the issue ?

dongkai1993-zz commented 7 years ago

Ok,ignore this error for the moment. Could I open /demo/MediaStream.html directly? I think, getUserMedia has been definded at least.But , adapter.debug.js:644 Uncaught SyntaxError: Invalid or unexpected token MediaStream.html:15 Uncaught ReferenceError: getUserMedia is not defined(…)

johache commented 7 years ago

Please don't use /demo/MediaStream.html

You'll notice that it was removed from our dev branch. This file should not have been here in the first place and should not be relied on.

If you are looking for code samples, please look at https://plugin.temasys.com.sg/demo/

dongkai1993-zz commented 7 years ago

Add <meta charset="utf-8"> to /demo/MediaStream.html,then the html could run. Maybe , I have found the solution , I need to try it. Thank you!

johache commented 7 years ago

Again, demo/MediaStream should NOT be used. It is not a maintained demo, and will be removed VERY soon.

If you are looking for a demo/code sample, your have plenty of those here : https://plugin.temasys.com.sg/demo/

dongkai1993-zz commented 7 years ago

Oh no, I still couldn't develop in node by npm install adapterjs.

kai@kai-B85M-D3H:/data/source/video-client-javascript$

gulp build

[16:13:03] Using gulpfile /data/source/video-client-javascript/gulpfile.js [16:13:03] Starting 'babel'... [16:13:08] Finished 'babel' after 4.64 s [16:13:08] Starting 'build'... [16:13:08] Finished 'build' after 4.23 ms

events.js:141 throw er; // Unhandled 'error' event ^ Error: module "./utils" not found from "/data/source/video-client-javascript/node_modules/adapterjs/publish/adapter.min.js" at notFound (/data/source/video-client-javascript/node_modules/gulp-browserify/node_modules/browserify/index.js:803:15) at /data/source/video-client-javascript/node_modules/gulp-browserify/node_modules/browserify/index.js:754:23 at /data/source/video-client-javascript/node_modules/gulp-browserify/node_modules/browserify/node_modules/browser-resolve/index.js:185:24 at /data/source/video-client-javascript/node_modules/gulp-browserify/node_modules/browserify/node_modules/resolve/lib/async.js:36:22 at load (/data/source/video-client-javascript/node_modules/gulp-browserify/node_modules/browserify/node_modules/resolve/lib/async.js:54:43) at /data/source/video-client-javascript/node_modules/gulp-browserify/node_modules/browserify/node_modules/resolve/lib/async.js:60:22 at /data/source/video-client-javascript/node_modules/gulp-browserify/node_modules/browserify/node_modules/resolve/lib/async.js:16:47 at FSReqWrap.oncomplete (fs.js:82:15)

my behavior is: var adapter = require('adapterjs');in index.js , use gulp-browserify to package them. A few months ago, do it like this successfully.

dongkai1993-zz commented 7 years ago

Version0.13.4 has none error. And, peerConnection.getStats().then(function(RTCStatesResponse){})RTCStatesResponse has none value, could I get the statistics when use AdapterJs?

andsouto commented 7 years ago

I'm experiencing the same problem.

I have created a minimal example for reproducing the problem here: https://github.com/kai670/adapterjserror

Steps to reproduce:

And the next error occurs:

Error: Cannot find module './utils' from '/~/adapterjserror/node_modules/adapterjs/publish'
    at /~/adapterjserror/node_modules/resolve/lib/async.js:55:21
    at load (/~/adapterjserror/node_modules/resolve/lib/async.js:69:43)
    at onex (/~/adapterjserror/node_modules/resolve/lib/async.js:92:31)
    at /~/adapterjserror/node_modules/resolve/lib/async.js:22:47
    at FSReqWrap.oncomplete (fs.js:123:15)

Doing the same with the previous version 0.13.4 and with webrtc/adapter works OK.

bart-jansen commented 7 years ago

Same here.. can't seem to get adapterjs 0.14.0 to work via npm, but 0.13.4 seems to work fine.. Anyone with a solution?

johache commented 7 years ago

So, it looks like the issue is that you are browserifying an already browserified file. You can see a thread discussing about similar issues here : http://stackoverflow.com/questions/31932891/browserify-with-already-browserified-files. It suggests solutions to that.

I recon that it's not an idea situation, and we'll look into a way of improving that, but I don't have an answer at this moment.

dongkai1993-zz commented 7 years ago

Yeah, we should publish the whole project Instead of browserified file to npm, unless the project was built on google-closure-library, and package it by google-closure-compiler.

dongkai1993-zz commented 7 years ago

Thx!