The Wayback Machine - http://web.archive.org/web/20221221093707/https://github.com/nuxt/nuxt.js/issues/10566
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

Error: Path variable [contenthash:7] not implemented in this context: [contenthash:7].js #10566

Open

xhemj opened this issue Jul 9, 2022 · 1 comment

Comments

@xhemj
Copy link

xhemj commented Jul 9, 2022

Versions

  • nuxt: v2.15.8
  • node: v16.13.2

Reproduction

https://github.com/xhemj/ERSSWiki

Additional Details
Error:

i Parsed 4 files in 0.5 seconds                                                                                                      @nuxt/content 08:10:25 
i Production build                                                                                                                                 08:10:26 
i Bundling for server and client side                                                                                                              08:10:26 
i Target: server                                                                                                                                   08:10:26 
i Using components loader to optimize imports                                                                                                      08:10:27 
i Discovered Components: .nuxt/components/readme.md                                                                                                08:10:27 
√ Builder initialized                                                                                                                              08:10:27 
√ Nuxt files generated                                                                                                                             08:10:27 
                                                                                                                                                            
× Client                                                                                                                                                    
  Compiled with some errors in 13.90s                                                                                                                       
                                                                                                                                                            
( ) Server                                                                                                                                                  
                                                                                                                                                            
                                                                                                                                                            
                                                                                                                                                            
Hash: 5e08fcc38d0adcbe164c                                                                                                                                  
Version: webpack 4.46.0                                                                                                                                     
Time: 13897ms                                                                                                                                               
Built at: 2022/07/09 8:10:42                                                                                                                              
                                      Asset       Size  Chunks               Chunk Names                                                                    
                                 0d69871.js   10.9 KiB       0  [immutable]  styles                                                                         
                                 7aa19b0.js    209 KiB       2  [immutable]  commons/app                                                                    
                                   LICENSES  531 bytes                                                                                                      
                            css/a33a7bb.css    464 KiB       0  [immutable]  styles                                                                         
                                 d25e129.js    117 KiB       1  [immutable]  app                                                                            
fonts/Poppins-400-devanagari1.64d5f06.woff2   38.6 KiB          [immutable]                                                                                 
 fonts/Poppins-400-latin-ext2.4f38b43.woff2   5.41 KiB          [immutable]                                                                                 
     fonts/Poppins-400-latin3.405055d.woff2    7.7 KiB          [immutable]                                                                                 
fonts/Poppins-700-devanagari4.349ed9f.woff2   38.2 KiB          [immutable]                                                                                 
 fonts/Poppins-700-latin-ext5.63d2a69.woff2   5.26 KiB          [immutable]                                                                                 
     fonts/Poppins-700-latin6.d86662f.woff2   7.63 KiB          [immutable]                                                                                 
Entrypoint app = 7aa19b0.js css/a33a7bb.css 0d69871.js d25e129.js                                                                                           
                                                                                                                                                            
ERROR in chunk runtime [entry]                                                                                                                              
Cannot convert undefined or null to object                                                                                                                  
                                                                                                                                                            
ERROR in chunk runtime [entry]                                                                                                                              
[contenthash:7].js                                                                                                                                          
Path variable [contenthash:7] not implemented in this context: [contenthash:7].js                                                                           
                                                                                                                                                            
 FATAL  Nuxt build error                                                                                                                           08:10:42 
                                                                                                                                                            
  at WebpackBundler.webpackCompile (node_modules\@nuxt\webpack\dist\webpack.js:2127:21)                                                                     
  at async WebpackBundler.build (node_modules\@nuxt\webpack\dist\webpack.js:2076:5)                                                                         
  at async Builder.build (node_modules\@nuxt\builder\dist\builder.js:327:5)                                                                                 
  at async Object.run (node_modules\@nuxt\cli\dist\cli-build.js:110:7)                                                                                      
  at async NuxtCommand.run (node_modules\@nuxt\cli\dist\cli-index.js:413:7)                                                                                                                                                                                                                       

nuxt.config.js:

const path = require("path");

export default {
  // Global page headers: https://go.nuxtjs.dev/config-head
  head: {
    title: "ERSS Wiki",
    htmlAttrs: {
      lang: "zh",
    },
    meta: [
      { charset: "utf-8" },
      { name: "viewport", content: "width=device-width, initial-scale=1" },
      { hid: "description", name: "description", content: "" },
      { name: "format-detection", content: "telephone=no" },
    ],
    link: [{ rel: "icon", type: "image/x-icon", href: "/64x64.png" }],
  },

  target: "server",

  // Global CSS: https://go.nuxtjs.dev/config-css
  css: ["ant-design-vue/dist/antd.css"],

  // Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
  plugins: ["@/plugins/antd-ui"],

  // Auto import components: https://go.nuxtjs.dev/config-components
  components: true,

  // Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
  buildModules: [
    // https://go.nuxtjs.dev/eslint
    "@nuxtjs/google-fonts",
    "@nuxtjs/eslint-module",
  ],

  // Modules: https://go.nuxtjs.dev/config-modules
  modules: ["@nuxt/content"],

  // Build Configuration: https://go.nuxtjs.dev/config-build
  build: {
    // analyze: true,
    babelrc: true,
    extractCSS: true,
    optimization: {
      splitChunks: {
        cacheGroups: {
          styles: {
            name: "styles",
            test: /\.(css|vue)$/,
            chunks: "all",
            enforce: true,
          },
        },
      },
    },
    extend(config, ctx) {
      config.resolve.alias["@ant-design/icons/lib/dist$"] = path.resolve(
        __dirname,
        "./plugins/antd-icon.js"
      ); 
      config.resolve.alias["@"] = path.resolve(__dirname, "../plugins");
    },
  },

  generate: {
    fallback: "404.html",
    routes: ["/wiki/Hello"],
  },

  content: {
    markdown: {
      // https://github.com/remarkjs/remark-external-links#options
      remarkExternalLinks: {
        target: "_blank",
        rel: "nofollow",
      },
    },
  },

  googleFonts: {
    display: "swap",
    useStylesheet: true,
    families: {
      Poppins: {
        wght: [400, 700],
      },
    },
  },
};

Steps to reproduce

  1. Run npm run build
  2. See the errors

What is Expected?

Successfully built

What is actually happening?

Error: Path variable [contenthash:7] not implemented in this context: [contenthash:7].js

I see that #6979 seems to raise the same issue, but when I run npm install --force it still doesn't work.

@s-cryptor
Copy link

s-cryptor commented Jul 12, 2022

I think it's webpack problem, try to downgrade its version to 4.2.0 or below

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

No branches or pull requests

2 participants