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

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

Closed
falstack opened this issue Aug 7, 2019 · 10 comments
Closed
Labels
priority: high High priority issue type: bug Something isn't working

Comments

@falstack
Copy link

falstack commented Aug 7, 2019

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

@marvinatgithub
Copy link

Similar problem here - I used npm. But vuepress dev docs works for me. Just npm run docs:dev (see below) (more) returns the mentioned error.

// package.json

"scripts": {
  "docs:dev": "vuepress dev docs"
  // more
}

Error message:

error-message

@falstack
Copy link
Author

falstack commented Aug 7, 2019

@marvinatgithub Yes,i use it too,sorry i'm lazy-:D

@flozero
Copy link
Collaborator

flozero commented Aug 7, 2019

duplicate of #1729

@flozero
Copy link
Collaborator

flozero commented Aug 7, 2019

and it seem's introduce a bug #1708

@kyleslight
Copy link

kyleslight commented 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.

@flozero
Copy link
Collaborator

flozero commented Aug 8, 2019

It's a really hard bug to find exactly what happen... After some google it's look about confusing module.exports / export with import / require.

@kefranabg kefranabg added the type: bug Something isn't working label Aug 12, 2019
@eduardosada
Copy link

Same problem here 😢

@sysebert
Copy link

@kyleslight - I have no idea how you figured that out, but I'm so thankful you did! Works great now :D

@kefranabg kefranabg added the priority: high High priority issue label Aug 22, 2019
@arnauddupuis
Copy link

@kyleslight same here: I have no idea how you figured that out but thanks anyway!

@meteorlxy
Copy link
Member

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",
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: high High priority issue type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

9 participants