question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

Bug report

Steps to reproduce

  1. vue create some-project
  2. yarn add -D vuepress
  3. vuepress dev docs
  4. open chrome devtool,you can see console:
vue.runtime.esm.js?2b0e:619 [Vue warn]: Failed to resolve async component: function Layout() {
    return __webpack_require__.e(/*! import() */ 0).then(__webpack_require__.bind(null, /*! ./node_modules/@vuepress/theme-default/layouts/Layout.vue */ "./node_modules/@vuepress/theme-default/layouts/Layout.vue"));
  }
Reason: TypeError: Cannot assign to read only property 'exports' of object '#<Object>'
  1. vuepress build docs,you can see shell:
(undefined) ./node_modules/@vuepress/plugin-search/SearchBox.vue?vue&type=style&index=0&lang=stylus& (./node_modules/mini-css-extract-plugin/dist/loader.js!./node_modules/@vuepress/core/node_modules/css-loader/dist/cjs.js??ref--13-oneOf-1-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref--13-oneOf-1-2!./node_modules/stylus-loader??ref--13-oneOf-1-3!./node_modules/@vuepress/core/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./node_modules/@vuepress/plugin-search/SearchBox.vue?vue&type=style&index=0&lang=stylus&)
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
TypeError: Cannot assign to read only property 'exports' of object '#<Object>'
    at Module.<anonymous> (/Users/yuistack/Documents/Test/test-press/node_modules/@vuepress/core/node_modules/css-loader/dist/cjs.js??ref--13-oneOf-1-1!/Users/yuistack/Documents/Test/test-press/node_modules/vue-loader/lib/loaders/stylePostLoader.js!/Users/yuistack/Documents/Test/test-press/node_modules/postcss-loader/src/index.js??ref--13-oneOf-1-2!/Users/yuistack/Documents/Test/test-press/node_modules/stylus-loader/index.js??ref--13-oneOf-1-3!/Users/yuistack/Documents/Test/test-press/node_modules/@vuepress/core/node_modules/cache-loader/dist/cjs.js??ref--0-0!/Users/yuistack/Documents/Test/test-press/node_modules/vue-loader/lib/index.js??vue-loader-options!/Users/yuistack/Documents/Test/test-press/node_modules/@vuepress/plugin-search/SearchBox.vue?vue&type=style&index=0&lang=stylus&:453:16)
    at Module.module.exports.module.exports (/Users/yuistack/Documents/Test/test-press/node_modules/@vuepress/core/node_modules/css-loader/dist/cjs.js??ref--13-oneOf-1-1!/Users/yuistack/Documents/Test/test-press/node_modules/vue-loader/lib/loaders/stylePostLoader.js!/Users/yuistack/Documents/Test/test-press/node_modules/postcss-loader/src/index.js??ref--13-oneOf-1-2!/Users/yuistack/Documents/Test/test-press/node_modules/stylus-loader/index.js??ref--13-oneOf-1-3!/Users/yuistack/Documents/Test/test-press/node_modules/@vuepress/core/node_modules/cache-loader/dist/cjs.js??ref--0-0!/Users/yuistack/Documents/Test/test-press/node_modules/vue-loader/lib/index.js??vue-loader-options!/Users/yuistack/Documents/Test/test-press/node_modules/@vuepress/plugin-search/SearchBox.vue?vue&type=style&index=0&lang=stylus&:471:30)
    at __webpack_require__ (/Users/yuistack/Documents/Test/test-press/node_modules/@vuepress/core/node_modules/css-loader/dist/cjs.js??ref--13-oneOf-1-1!/Users/yuistack/Documents/Test/test-press/node_modules/vue-loader/lib/loaders/stylePostLoader.js!/Users/yuistack/Documents/Test/test-press/node_modules/postcss-loader/src/index.js??ref--13-oneOf-1-2!/Users/yuistack/Documents/Test/test-press/node_modules/stylus-loader/index.js??ref--13-oneOf-1-3!/Users/yuistack/Documents/Test/test-press/node_modules/@vuepress/core/node_modules/cache-loader/dist/cjs.js??ref--0-0!/Users/yuistack/Documents/Test/test-press/node_modules/vue-loader/lib/index.js??vue-loader-options!/Users/yuistack/Documents/Test/test-press/node_modules/@vuepress/plugin-search/SearchBox.vue?vue&type=style&index=0&lang=stylus&:21:30)
    at Object.module.exports.module.exports (/Users/yuistack/Documents/Test/test-press/node_modules/@vuepress/core/node_modules/css-loader/dist/cjs.js??ref--13-oneOf-1-1!/Users/yuistack/Documents/Test/test-press/node_modules/vue-loader/lib/loaders/stylePostLoader.js!/Users/yuistack/Documents/Test/test-press/node_modules/postcss-loader/src/index.js??ref--13-oneOf-1-2!/Users/yuistack/Documents/Test/test-press/node_modules/stylus-loader/index.js??ref--13-oneOf-1-3!/Users/yuistack/Documents/Test/test-press/node_modules/@vuepress/core/node_modules/cache-loader/dist/cjs.js??ref--0-0!/Users/yuistack/Documents/Test/test-press/node_modules/vue-loader/lib/index.js??vue-loader-options!/Users/yuistack/Documents/Test/test-press/node_modules/@vuepress/plugin-search/SearchBox.vue?vue&type=style&index=0&lang=stylus&:342:17)
    at __webpack_require__ (/Users/yuistack/Documents/Test/test-press/node_modules/@vuepress/core/node_modules/css-loader/dist/cjs.js??ref--13-oneOf-1-1!/Users/yuistack/Documents/Test/test-press/node_modules/vue-loader/lib/loaders/stylePostLoader.js!/Users/yuistack/Documents/Test/test-press/node_modules/postcss-loader/src/index.js??ref--13-oneOf-1-2!/Users/yuistack/Documents/Test/test-press/node_modules/stylus-loader/index.js??ref--13-oneOf-1-3!/Users/yuistack/Documents/Test/test-press/node_modules/@vuepress/core/node_modules/cache-loader/dist/cjs.js??ref--0-0!/Users/yuistack/Documents/Test/test-press/node_modules/vue-loader/lib/index.js??vue-loader-options!/Users/yuistack/Documents/Test/test-press/node_modules/@vuepress/plugin-search/SearchBox.vue?vue&type=style&index=0&lang=stylus&:21:30)
    at /Users/yuistack/Documents/Test/test-press/node_modules/@vuepress/core/node_modules/css-loader/dist/cjs.js??ref--13-oneOf-1-1!/Users/yuistack/Documents/Test/test-press/node_modules/vue-loader/lib/loaders/stylePostLoader.js!/Users/yuistack/Documents/Test/test-press/node_modules/postcss-loader/src/index.js??ref--13-oneOf-1-2!/Users/yuistack/Documents/Test/test-press/node_modules/stylus-loader/index.js??ref--13-oneOf-1-3!/Users/yuistack/Documents/Test/test-press/node_modules/@vuepress/core/node_modules/cache-loader/dist/cjs.js??ref--0-0!/Users/yuistack/Documents/Test/test-press/node_modules/vue-loader/lib/index.js??vue-loader-options!/Users/yuistack/Documents/Test/test-press/node_modules/@vuepress/plugin-search/SearchBox.vue?vue&type=style&index=0&lang=stylus&:85:18
    at Object.<anonymous> (/Users/yuistack/Documents/Test/test-press/node_modules/@vuepress/core/node_modules/css-loader/dist/cjs.js??ref--13-oneOf-1-1!/Users/yuistack/Documents/Test/test-press/node_modules/vue-loader/lib/loaders/stylePostLoader.js!/Users/yuistack/Documents/Test/test-press/node_modules/postcss-loader/src/index.js??ref--13-oneOf-1-2!/Users/yuistack/Documents/Test/test-press/node_modules/stylus-loader/index.js??ref--13-oneOf-1-3!/Users/yuistack/Documents/Test/test-press/node_modules/@vuepress/core/node_modules/cache-loader/dist/cjs.js??ref--0-0!/Users/yuistack/Documents/Test/test-press/node_modules/vue-loader/lib/index.js??vue-loader-options!/Users/yuistack/Documents/Test/test-press/node_modules/@vuepress/plugin-search/SearchBox.vue?vue&type=style&index=0&lang=stylus&:88:10)
    at Module._compile (internal/modules/cjs/loader.js:688:30)
    at exec (/Users/yuistack/Documents/Test/test-press/node_modules/mini-css-extract-plugin/dist/loader.js:58:10)
    at childCompiler.runAsChild (/Users/yuistack/Documents/Test/test-press/node_modules/mini-css-extract-plugin/dist/loader.js:151:14)
    at compile (/Users/yuistack/Documents/Test/test-press/node_modules/@vuepress/core/node_modules/webpack/lib/Compiler.js:343:11)
    at hooks.afterCompile.callAsync.err (/Users/yuistack/Documents/Test/test-press/node_modules/@vuepress/core/node_modules/webpack/lib/Compiler.js:671:15)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/yuistack/Documents/Test/test-press/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
    at AsyncSeriesHook.lazyCompileHook (/Users/yuistack/Documents/Test/test-press/node_modules/tapable/lib/Hook.js:154:20)
    at compilation.seal.err (/Users/yuistack/Documents/Test/test-press/node_modules/@vuepress/core/node_modules/webpack/lib/Compiler.js:668:31)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/yuistack/Documents/Test/test-press/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
 @ ./node_modules/@vuepress/plugin-search/SearchBox.vue?vue&type=style&index=0&lang=stylus& 1:0-435 1:451-454 1:456-888 1:456-888
 @ ./node_modules/@vuepress/plugin-search/SearchBox.vue
 @ ./node_modules/@vuepress/core/node_modules/cache-loader/dist/cjs.js??ref--3-0!./node_modules/babel-loader/lib??ref--3-1!./node_modules/@vuepress/core/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./node_modules/@vuepress/theme-default/components/Navbar.vue?vue&type=script&lang=js&
 @ ./node_modules/@vuepress/theme-default/components/Navbar.vue?vue&type=script&lang=js&
 @ ./node_modules/@vuepress/theme-default/components/Navbar.vue
 @ ./node_modules/@vuepress/core/node_modules/cache-loader/dist/cjs.js??ref--3-0!./node_modules/babel-loader/lib??ref--3-1!./node_modules/@vuepress/core/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./node_modules/@vuepress/theme-default/layouts/Layout.vue?vue&type=script&lang=js&
 @ ./node_modules/@vuepress/theme-default/layouts/Layout.vue?vue&type=script&lang=js&
 @ ./node_modules/@vuepress/theme-default/layouts/Layout.vue
 @ ./node_modules/@vuepress/core/.temp/internal/layout-components.js
 @ ./node_modules/@vuepress/core/lib/client/util.js
 @ ./node_modules/@vuepress/core/lib/client/app.js
 @ ./node_modules/@vuepress/core/lib/client/clientEntry.js
 @ multi ./node_modules/@vuepress/core/lib/client/clientEntry.js
Error: Failed to compile with errors.
    at webpack (/Users/yuistack/Documents/Test/test-press/node_modules/@vuepress/core/lib/node/build/index.js:186:16)
    at finalCallback (/Users/yuistack/Documents/Test/test-press/node_modules/@vuepress/core/node_modules/webpack/lib/MultiCompiler.js:254:12)
    at runWithDependencies.err (/Users/yuistack/Documents/Test/test-press/node_modules/@vuepress/core/node_modules/webpack/lib/MultiCompiler.js:277:6)
    at done (/Users/yuistack/Documents/Test/test-press/node_modules/neo-async/async.js:2931:13)
    at runCompilers (/Users/yuistack/Documents/Test/test-press/node_modules/@vuepress/core/node_modules/webpack/lib/MultiCompiler.js:181:48)
    at err (/Users/yuistack/Documents/Test/test-press/node_modules/@vuepress/core/node_modules/webpack/lib/MultiCompiler.js:188:7)
    at compiler.run (/Users/yuistack/Documents/Test/test-press/node_modules/@vuepress/core/node_modules/webpack/lib/MultiCompiler.js:270:7)
    at finalCallback (/Users/yuistack/Documents/Test/test-press/node_modules/@vuepress/core/node_modules/webpack/lib/Compiler.js:257:39)
    at hooks.done.callAsync.err (/Users/yuistack/Documents/Test/test-press/node_modules/@vuepress/core/node_modules/webpack/lib/Compiler.js:273:13)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/yuistack/Documents/Test/test-press/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:33:1)
    at AsyncSeriesHook.lazyCompileHook (/Users/yuistack/Documents/Test/test-press/node_modules/tapable/lib/Hook.js:154:20)
    at onCompiled (/Users/yuistack/Documents/Test/test-press/node_modules/@vuepress/core/node_modules/webpack/lib/Compiler.js:271:21)
    at hooks.afterCompile.callAsync.err (/Users/yuistack/Documents/Test/test-press/node_modules/@vuepress/core/node_modules/webpack/lib/Compiler.js:671:15)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/yuistack/Documents/Test/test-press/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook (/Users/yuistack/Documents/Test/test-press/node_modules/tapable/lib/Hook.js:154:20)
    at compilation.seal.err (/Users/yuistack/Documents/Test/test-press/node_modules/@vuepress/core/node_modules/webpack/lib/Compiler.js:668:31)
npm ERR! code ELIFECYCLE
  1. about repo:vuepress-bug-report

What is expected?

vuepress can work with vue-cli

What is actually happening?

vuepress can’t work with vue-cli

Other relevant information

Environment Info:

  System:
    OS: macOS 10.14.5
    CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
  Binaries:
    Node: 10.13.0 - ~/.nvm/versions/node/v10.13.0/bin/node
    Yarn: 1.16.0 - /usr/local/bin/yarn
    npm: 6.10.2 - ~/.nvm/versions/node/v10.13.0/bin/npm
  Browsers:
    Chrome: 75.0.3770.142
    Firefox: 67.0.2
    Safari: 12.1.1
  npmPackages:
    @vuepress/core:  1.0.3
    @vuepress/theme-default:  1.0.3
    vuepress: ^1.0.3 => 1.0.3
  npmGlobalPackages:
    vuepress: Not Found

vue-cli version:3.1.0

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:8
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

10reactions
kyleslightcommented, Aug 8, 2019

The same problem here, I find out in my project it’s related with @vue/cli-service

I remove @vue/cli-service in package.json and install packages again, my project works.

1reaction
meteorlxycommented, Sep 5, 2019

Seems that it’s caused by #1685.

So my workaround is to downgrade @vuepress/core to v1.0.2 (sad 😢 ):

  "dependencies": {
    "@vuepress/core": "1.0.2",
    "vuepress": "1.0.2",
  }
Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot assign to read only property 'exports' of object ...
This error means you are trying to use commonJS inside a ES module. Instead try doing: export default lookup. When you are instantiating...
Read more >
Cannot assign to read only property 'exports' of object ... - GitHub
In my react-native-web case, just use an additional webpack rule, then the TypeError: Cannot assign to read only property 'exports' of object is ......
Read more >
TypeError: Cannot assign to read only property 'exports' of ...
The error is generated by Webpack and it means you are trying to use CommonJS while you need to use ES modules!
Read more >
Uncaught TypeError: Cannot assign to read only property &#38
When I look at the line it has something to do with bsCustomFileInput. Please insert min.
Read more >
Webpack: Cannot assign to read only property 'exports'
ERRO[0105 ] TypeError: Cannot assign to read only property 'exports' ... an object and then something else tried to overwrite this property.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found