ember-browserify icon indicating copy to clipboard operation
ember-browserify copied to clipboard

findAMDImports Error

Open iamjstates opened this issue 7 years ago • 10 comments

I updated to version 1.2.0 and started getting this error -> downgraded to 1.1.13 and the error is gone.

ember version: ember-cli: 2.15.0-beta.1 node: 6.11.1 os: darwin x64

Error: Error parsing code while looking for "npm:" imports: TypeError: Cannot read property 'elements' of undefined
    at findAMDImports (/Users/admin/Development/Projects/theirry-commerce/node_modules/ember-browserify/lib/stubs.js:114:6)
    at /Users/admin/Development/Projects/theirry-commerce/node_modules/ember-browserify/lib/stubs.js:97:7
    at forEachNode (/Users/admin/Development/Projects/theirry-commerce/node_modules/ember-browserify/lib/stubs.js:74:5)
    at forEachNode (/Users/admin/Development/Projects/theirry-commerce/node_modules/ember-browserify/lib/stubs.js:77:7)
    at forEachNode (/Users/admin/Development/Projects/theirry-commerce/node_modules/ember-browserify/lib/stubs.js:77:7)
    at forEachNode (/Users/admin/Development/Projects/theirry-commerce/node_modules/ember-browserify/lib/stubs.js:77:7)
    at forEachNode (/Users/admin/Development/Projects/theirry-commerce/node_modules/ember-browserify/lib/stubs.js:77:7)
    at forEachNode (/Users/admin/Development/Projects/theirry-commerce/node_modules/ember-browserify/lib/stubs.js:77:7)
    at forEachNode (/Users/admin/Development/Projects/theirry-commerce/node_modules/ember-browserify/lib/stubs.js:77:7)
    at forEachNode (/Users/admin/Development/Projects/theirry-commerce/node_modules/ember-browserify/lib/stubs.js:77:7)
    at importsFor (/Users/admin/Development/Projects/theirry-commerce/node_modules/ember-browserify/lib/stubs.js:67:11)
    at Stub.set (/Users/admin/Development/Projects/theirry-commerce/node_modules/ember-browserify/lib/stubs.js:31:25)
    at StubGenerator.<anonymous> (/Users/admin/Development/Projects/theirry-commerce/node_modules/ember-browserify/lib/stub-generator.js:57:33)
    at Array.forEach (native)
    at StubGenerator.build (/Users/admin/Development/Projects/theirry-commerce/node_modules/ember-browserify/lib/stub-generator.js:49:12)
    at /Users/admin/Development/Projects/theirry-commerce/node_modules/broccoli-plugin/read_compat.js:93:34
    at tryCatch (/Users/admin/Development/Projects/theirry-commerce/node_modules/rsvp/dist/rsvp.js:525:12)
    at invokeCallback (/Users/admin/Development/Projects/theirry-commerce/node_modules/rsvp/dist/rsvp.js:538:13)
    at publish (/Users/admin/Development/Projects/theirry-commerce/node_modules/rsvp/dist/rsvp.js:508:7)
    at flush (/Users/admin/Development/Projects/theirry-commerce/node_modules/rsvp/dist/rsvp.js:2400:5)

iamjstates avatar Jul 16 '17 22:07 iamjstates

could you provide a reproduction? Specifically a list of npm modules + versions that are being browserified. Otherwise its a tad tricky to figure out whatsup

stefanpenner avatar Jul 16 '17 23:07 stefanpenner

I'm having the same issue. I'm browserifying autosize 4.0.0 and rails-timezone 1.0.0.

bryanhickerson avatar Aug 29 '17 18:08 bryanhickerson

Still blocked from upgrading due to this issue. Current browserified npm packages:

"@opentok/client": "^2.12.2",
"autosize": "^4.0.0",
"bowser": "^1.8.1",
"pubnub": "^4.17.0",
"uuid": "^3.1.0",
"rails-timezone": "^1.0.0"

bryanhickerson avatar Jan 11 '18 00:01 bryanhickerson

Hi @bryanhickerson, I tried to reproduce the bug using your list but was unable to get the error. Here is the app I used, it has a yarn.lock so you can see what exact versions I used:

https://github.com/ef4/bug-repro/tree/7bcc6b80c58333a67414c9b9c9429697da8a90c1

If you can pare down your app to the smallest thing that still fails, that would help find the problem.

ef4 avatar Jan 15 '18 17:01 ef4

I'll see what I can do.

bryanhickerson avatar Jan 15 '18 17:01 bryanhickerson

Tried creating a stripped down app with the error, but haven't been able to reproduce so far. I suspect it could one one of our other packages.

bryanhickerson avatar Jan 23 '18 15:01 bryanhickerson

Even with our full package.json it's not occurring, is there anything I can do to debug it myself on our full app?

bryanhickerson avatar Jan 23 '18 16:01 bryanhickerson

It appears to only happen when running ember test, able to build the app normally just fine.

bryanhickerson avatar Jan 24 '18 15:01 bryanhickerson

I'm having the same issue when running the server

  • ember-browserify: ~1.2.1
  • country-data: 0.0.24
import countryData from 'npm:country-data'

spieker avatar Feb 16 '18 09:02 spieker

@ef4 I was able to reproduce the issue in a small app: https://github.com/bryanhickerson/ember-browserify-import-error. It doesn't actually require any imports, the exception is happening in an ember-data-factory-guy factory definition. I was actually able to figure this out by printing out the full path even when the stack trace existed. I'm going to open a PR for that change.

bryanhickerson avatar Mar 14 '18 21:03 bryanhickerson