Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vue Uncaught TypeError: Cannot assign to read only property 'exports' of object '#<Object>' #6

Open
azimidev opened this issue Jul 7, 2017 · 11 comments

Comments

@azimidev
Copy link

azimidev commented Jul 7, 2017

The code is ok. However you can mix require and export. You can't mix import and module.exports.
In your main.js replace this:

import VueAdsense from './VueAdsense.vue'
module.exports = VueAdsense

with this:

import VueAdsense from './VueAdsense.vue'
export default VueAdsense
@jamesmskelsey
Copy link

jamesmskelsey commented Jul 7, 2017

Funny - you and I are doing the same work. Just ran in to the same problem. Of course... now I get a 404 error and the ads won't load on the page, but I don't think that's this components fault. That may be a service-worker issue.

Darrynten - I just checked it looks like you fixed it here, but when downloading from npm the error is still present. Just fyi =)

@azimidev
Copy link
Author

azimidev commented Jul 7, 2017

I am working with Vue and it is components fault. Revert your last commit. I did it and it worked

@darrynten
Copy link
Owner

@jamesmskelsey hi there, does the latest dev work for you but the npm one doesn't?

@jamesmskelsey
Copy link

@darrynten Yeah man, got the latest dev to work just fine. Heck, what I ended up doing was just manually changing the line that needed changed. When I downloaded it from npm, it was still giving the error from issue 3.

@darrynten
Copy link
Owner

Hi @jamesmskelsey, any chance of a pull request?

Would be amazing ✨

@scofield-ua
Copy link

scofield-ua commented Sep 12, 2017

hey @darrynten, I just installed the package and still can see this error because main.js file is not updated.

Currently, it looks like this:

import VueAdsense from './VueAdsense.vue'
module.exports = VueAdsense

@ShiraMiyuko
Copy link

Confirmed, this issue still on npm

@VetSoftKeith
Copy link

also confirming, still an issue with npm version. repo version works great.

@craigh411
Copy link

The way to get around this is to:

  1. Fork the repo, so you have control of commits made to master
  2. Install your forked repo by doing: npm install yourusername/vue-adsense#master --save-dev

Done!

@MitsuhaKitsune
Copy link

MitsuhaKitsune commented Jul 12, 2018

@craigh411 Yes you are right, im my case I should do npm install git+https://github.com/darrynten/vue-adsense.git, the username/repo option don't work for me.

Take notice that you use --save-dev instead --save, if you use --save-dev the module are only available on development enviroment, you should use --save for vue modules.

@craigh411
Copy link

craigh411 commented Jul 13, 2018

@MitsuhaKitsune I'm glad it helped. I always use --save-dev for npm packages because I bundle them using webpack, so there's no need for them to be on the production server, however, if you aren't bundling them, then you will need to use --save instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants