2018.12.07 17:21

nuxt1.4.x在node10.x下打包报错To install it, you can run: npm install --save fs


nuxt1.4.x在node10.x下打包报错To install it, you can run: npm install --save fs

打包报错复现环境

"nuxt": "1.4.2",
“node”:"10.12.0",
"npm":"6.4.1"

报错截图

qq 20181207171243

引入的nuxt配置文件中增加

extend (config, { isDev, isClient }) {
    if (isDev && isClient) {
      config.module.rules.push({
        enforce: 'pre',
        test: /\.(js|vue)$/,
        loader: 'eslint-loader',
        exclude: [
          /(node_modules)/,
          path.resolve(__dirname, "../components/element")
        ]
      })
    }
  
   //增加下面的配置
     config.node = {
            fs: "empty"
      };
 
  },

解决后可以通过打包了

11111111111111

还有一种解决方案就是升级NUXT 到2.0 版本,可以参考我的nuxt博客代码仓库


nuxt build

nuxtbuild


(node:16588) ExperimentalWarning: The fs.promises API is experimental

████████████████████ 91% additional chunk assets processingdditional chunk assets processinKilled

卡住在91%

已经确认了问题,是因为服务器剩余内存不足。可以换个内存大点的机器部署nuxt ssr 渲染项目


文章首发地址:https://github.com/jackieli123723/jackieli123723.github.io/issues/68

DIY表情

(添加http或https协议)

提交评论