matfish2 / vue-stripe

Vue.js 2 Stripe checkout component
https://www.npmjs.com/package/vue-stripe
MIT License
58 stars 18 forks source link

first Install on vuejs 2 #15

Closed sidbenac closed 7 years ago

sidbenac commented 7 years ago

Hi

i just did an install on my application, but it doesn't work, I did exactly as documented, here is the error bus.js?8381:3 Uncaught TypeError: Vue is not a constructor at eval (eval at <anonymous> (app.js:1151), <anonymous>:3:18) at Object.<anonymous> (app.js:1151) at __webpack_require__ (app.js:660) at fn (app.js:84) at eval (eval at <anonymous> (app.js:1297), <anonymous>:25:12) at Object.<anonymous> (app.js:1297) at __webpack_require__ (app.js:660) at fn (app.js:84) at eval (eval at <anonymous> (app.js:1703), <anonymous>:3:3) at Object.<anonymous> (app.js:1703)

the error comes from bus.js,

thx for your help

matfish2 commented 7 years ago

Code please.

sidbenac commented 7 years ago

actually i went straight forward I did follow the documentation to install instantiate in component and poof had the error mentioned.

Solved by changing the module.exports in all scripts by using export default or export cons

in index.js

import { vBus } from './bus'

export const  StripeCheckout = require ('./StripeCheckout.vue')
export const  Bus = vBus

in bus.js

import Vue from 'vue'

export const vBus = new Vue()

in StripeCheckout.vue

import { vBus} from './bus'
   var  bus= vBus

I know this is not the best way to do it, but this is just how it solved my problem,

I also see other behaviors and errors that I will open a separate issues.

Sid

matfish2 commented 7 years ago

Fixed by PR #14

NoelDavies commented 7 years ago

I've currently got the same or a very similar issue. Uncaught TypeError: Vue is not a constructor at eval (eval at <anonymous> (app.js:327), <anonymous>:3:18) at Object.<anonymous> (app.js:327) at __webpack_require__ (app.js:20) at eval (eval at <anonymous> (app.js:508), <anonymous>:25:12) at Object.<anonymous> (app.js:508) at __webpack_require__ (app.js:20) at eval (eval at <anonymous> (app.js:889), <anonymous>:3:3) at Object.<anonymous> (app.js:889) at __webpack_require__ (app.js:20) at eval (eval at <anonymous> (app.js:424), <anonymous>:2:78)

chip commented 7 years ago

Similar issue for me as well:

bus.js:3 Uncaught TypeError: Vue is not a constructor
    at Object.defineProperty.value (bus.js:3)
    at __webpack_require__ (bootstrap 76adc7d…:657)
    at fn (bootstrap 76adc7d…:85)
    at Object.defineProperty.value (StripeCheckout.vue:16)
    at __webpack_require__ (bootstrap 76adc7d…:657)
    at fn (bootstrap 76adc7d…:85)
    at Object.module.exports.render._vm (StripeCheckout.vue:3)
    at __webpack_require__ (bootstrap 76adc7d…:657)
    at fn (bootstrap 76adc7d…:85)
    at Object.defineProperty.value (app.js:28022)
EmraanSiddiqui commented 7 years ago

@matfish2 I am also facing same issue. OS: Windows 10 Node: 7.8.0 Npm: 4.2.0

mayk93 commented 7 years ago

@matfish2

Me too. I have the same problem, both with vue-stripe and vue-stripe-async, which appear to be the same module, but under different npm names.

In any case, I tried a solution that looks like this:

import Stripe from 'vue-stripe
components: {'stripe-checkout': Stripe.StripeCheckout, 'bus': Stripe.Bus}

But unfortunately this does not work either.