Actionhero build failing with unexpected token error











up vote
0
down vote

favorite












I am working on a React JS project where I have used ActionHero as a server.
On the localhost, everything is working fine, but when I tried to build the project locally I go this error message.



vishal@vishal-pc:~/projects/x1-platform$ yarn run build
yarn run v1.12.3
warning package.json: No license field
warning ../../package.json: No license field
$ next build
> Using external babel configuration
> Location: "/home/vishal/projects/x1-platform/.babelrc"
> Using "webpack" config function defined in next.config.js.
> Failed to build on /tmp/c7a64326-b0fb-42d4-8537-3e83712fee01
{ Error: commons.js from UglifyJs
Unexpected token: punc ()) [commons.js:83270,22]
at /home/ampcome/projects/x1-platform/node_modules/next/dist/server/build/index.js:183:21
at emitRecords.err (/home/ampcome/projects/x1-platform/node_modules/webpack/lib/Compiler.js:269:13)
at Compiler.emitRecords (/home/ampcome/projects/x1-platform/node_modules/webpack/lib/Compiler.js:375:38)
at emitAssets.err (/home/ampcome/projects/x1-platform/node_modules/webpack/lib/Compiler.js:262:10)
at applyPluginsAsyncSeries1.err (/home/ampcome/projects/x1-platform/node_modules/webpack/lib/Compiler.js:368:12)
at next (/home/ampcome/projects/x1-platform/node_modules/tapable/lib/Tapable.js:218:11)
at Compiler.compiler.plugin (/home/ampcome/projects/x1-platform/node_modules/webpack/lib/performance/SizeLimitsPlugin.js:99:4)
at Compiler.applyPluginsAsyncSeries1 (/home/ampcome/projects/x1-platform/node_modules/tapable/lib/Tapable.js:222:13)
at Compiler.afterEmit (/home/ampcome/projects/x1-platform/node_modules/webpack/lib/Compiler.js:365:9)
at require.forEach.err (/home/ampcome/projects/x1-platform/node_modules/webpack/lib/Compiler.js:354:15)
at /home/ampcome/projects/x1-platform/node_modules/async/dist/async.js:473:16
at iteratorCallback (/home/ampcome/projects/x1-platform/node_modules/async/dist/async.js:1064:13)
at /home/ampcome/projects/x1-platform/node_modules/async/dist/async.js:969:16
at /home/ampcome/projects/x1-platform/node_modules/graceful-fs/graceful-fs.js:45:10
at FSReqWrap.oncomplete (fs.js:141:20)
errors:
[ 'commons.js from UglifyJsnUnexpected token: punc ()) [commons.js:83270,22]' ],
warnings: }
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.


next.config.js file



const path = require('path');
const merge = require('lodash.merge');
const glob = require('glob')
const Uglify = require('uglifyjs-webpack-plugin');
module.exports = {
webpack: (config) => {
config.resolve = merge({}, config.resolve, {
alias: {
Components: path.resolve(__dirname, 'components'),
Libs: path.resolve(__dirname, 'libs'),
Sagas: path.resolve(__dirname, 'sagas'),
},
});


config.module.rules.push(
{
test: /.(css|scss)/,
loader: 'emit-file-loader',
options: {
name: 'dist/[path][name].[ext]'
}
}
,
{
test: /.css$/,
use: ['babel-loader', 'raw-loader', 'postcss-loader']
}
,
{
test: /.css$/,
loaders: [
'style-loader',
'css-loader'
]
},
{
test: /.s(a|c)ss$/,
use: ['babel-loader', 'raw-loader', 'postcss-loader',
{ loader: 'sass-loader',
options: {
includePaths: ['scss', 'node_modules','styles']
.map((d) => path.join(__dirname, d))
.map((g) => glob.sync(g))
.reduce((a, c) => a.concat(c), )
}
}
]
}
)
config.node = {
fs: 'empty',
};
return config;
},
};


There are a lot of solutions given on the StackOverflow for this problem, but none of them are working for me.



I tried deactivating the Uglify plugin but that too is not working.










share|improve this question




























    up vote
    0
    down vote

    favorite












    I am working on a React JS project where I have used ActionHero as a server.
    On the localhost, everything is working fine, but when I tried to build the project locally I go this error message.



    vishal@vishal-pc:~/projects/x1-platform$ yarn run build
    yarn run v1.12.3
    warning package.json: No license field
    warning ../../package.json: No license field
    $ next build
    > Using external babel configuration
    > Location: "/home/vishal/projects/x1-platform/.babelrc"
    > Using "webpack" config function defined in next.config.js.
    > Failed to build on /tmp/c7a64326-b0fb-42d4-8537-3e83712fee01
    { Error: commons.js from UglifyJs
    Unexpected token: punc ()) [commons.js:83270,22]
    at /home/ampcome/projects/x1-platform/node_modules/next/dist/server/build/index.js:183:21
    at emitRecords.err (/home/ampcome/projects/x1-platform/node_modules/webpack/lib/Compiler.js:269:13)
    at Compiler.emitRecords (/home/ampcome/projects/x1-platform/node_modules/webpack/lib/Compiler.js:375:38)
    at emitAssets.err (/home/ampcome/projects/x1-platform/node_modules/webpack/lib/Compiler.js:262:10)
    at applyPluginsAsyncSeries1.err (/home/ampcome/projects/x1-platform/node_modules/webpack/lib/Compiler.js:368:12)
    at next (/home/ampcome/projects/x1-platform/node_modules/tapable/lib/Tapable.js:218:11)
    at Compiler.compiler.plugin (/home/ampcome/projects/x1-platform/node_modules/webpack/lib/performance/SizeLimitsPlugin.js:99:4)
    at Compiler.applyPluginsAsyncSeries1 (/home/ampcome/projects/x1-platform/node_modules/tapable/lib/Tapable.js:222:13)
    at Compiler.afterEmit (/home/ampcome/projects/x1-platform/node_modules/webpack/lib/Compiler.js:365:9)
    at require.forEach.err (/home/ampcome/projects/x1-platform/node_modules/webpack/lib/Compiler.js:354:15)
    at /home/ampcome/projects/x1-platform/node_modules/async/dist/async.js:473:16
    at iteratorCallback (/home/ampcome/projects/x1-platform/node_modules/async/dist/async.js:1064:13)
    at /home/ampcome/projects/x1-platform/node_modules/async/dist/async.js:969:16
    at /home/ampcome/projects/x1-platform/node_modules/graceful-fs/graceful-fs.js:45:10
    at FSReqWrap.oncomplete (fs.js:141:20)
    errors:
    [ 'commons.js from UglifyJsnUnexpected token: punc ()) [commons.js:83270,22]' ],
    warnings: }
    error Command failed with exit code 1.
    info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.


    next.config.js file



    const path = require('path');
    const merge = require('lodash.merge');
    const glob = require('glob')
    const Uglify = require('uglifyjs-webpack-plugin');
    module.exports = {
    webpack: (config) => {
    config.resolve = merge({}, config.resolve, {
    alias: {
    Components: path.resolve(__dirname, 'components'),
    Libs: path.resolve(__dirname, 'libs'),
    Sagas: path.resolve(__dirname, 'sagas'),
    },
    });


    config.module.rules.push(
    {
    test: /.(css|scss)/,
    loader: 'emit-file-loader',
    options: {
    name: 'dist/[path][name].[ext]'
    }
    }
    ,
    {
    test: /.css$/,
    use: ['babel-loader', 'raw-loader', 'postcss-loader']
    }
    ,
    {
    test: /.css$/,
    loaders: [
    'style-loader',
    'css-loader'
    ]
    },
    {
    test: /.s(a|c)ss$/,
    use: ['babel-loader', 'raw-loader', 'postcss-loader',
    { loader: 'sass-loader',
    options: {
    includePaths: ['scss', 'node_modules','styles']
    .map((d) => path.join(__dirname, d))
    .map((g) => glob.sync(g))
    .reduce((a, c) => a.concat(c), )
    }
    }
    ]
    }
    )
    config.node = {
    fs: 'empty',
    };
    return config;
    },
    };


    There are a lot of solutions given on the StackOverflow for this problem, but none of them are working for me.



    I tried deactivating the Uglify plugin but that too is not working.










    share|improve this question


























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I am working on a React JS project where I have used ActionHero as a server.
      On the localhost, everything is working fine, but when I tried to build the project locally I go this error message.



      vishal@vishal-pc:~/projects/x1-platform$ yarn run build
      yarn run v1.12.3
      warning package.json: No license field
      warning ../../package.json: No license field
      $ next build
      > Using external babel configuration
      > Location: "/home/vishal/projects/x1-platform/.babelrc"
      > Using "webpack" config function defined in next.config.js.
      > Failed to build on /tmp/c7a64326-b0fb-42d4-8537-3e83712fee01
      { Error: commons.js from UglifyJs
      Unexpected token: punc ()) [commons.js:83270,22]
      at /home/ampcome/projects/x1-platform/node_modules/next/dist/server/build/index.js:183:21
      at emitRecords.err (/home/ampcome/projects/x1-platform/node_modules/webpack/lib/Compiler.js:269:13)
      at Compiler.emitRecords (/home/ampcome/projects/x1-platform/node_modules/webpack/lib/Compiler.js:375:38)
      at emitAssets.err (/home/ampcome/projects/x1-platform/node_modules/webpack/lib/Compiler.js:262:10)
      at applyPluginsAsyncSeries1.err (/home/ampcome/projects/x1-platform/node_modules/webpack/lib/Compiler.js:368:12)
      at next (/home/ampcome/projects/x1-platform/node_modules/tapable/lib/Tapable.js:218:11)
      at Compiler.compiler.plugin (/home/ampcome/projects/x1-platform/node_modules/webpack/lib/performance/SizeLimitsPlugin.js:99:4)
      at Compiler.applyPluginsAsyncSeries1 (/home/ampcome/projects/x1-platform/node_modules/tapable/lib/Tapable.js:222:13)
      at Compiler.afterEmit (/home/ampcome/projects/x1-platform/node_modules/webpack/lib/Compiler.js:365:9)
      at require.forEach.err (/home/ampcome/projects/x1-platform/node_modules/webpack/lib/Compiler.js:354:15)
      at /home/ampcome/projects/x1-platform/node_modules/async/dist/async.js:473:16
      at iteratorCallback (/home/ampcome/projects/x1-platform/node_modules/async/dist/async.js:1064:13)
      at /home/ampcome/projects/x1-platform/node_modules/async/dist/async.js:969:16
      at /home/ampcome/projects/x1-platform/node_modules/graceful-fs/graceful-fs.js:45:10
      at FSReqWrap.oncomplete (fs.js:141:20)
      errors:
      [ 'commons.js from UglifyJsnUnexpected token: punc ()) [commons.js:83270,22]' ],
      warnings: }
      error Command failed with exit code 1.
      info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.


      next.config.js file



      const path = require('path');
      const merge = require('lodash.merge');
      const glob = require('glob')
      const Uglify = require('uglifyjs-webpack-plugin');
      module.exports = {
      webpack: (config) => {
      config.resolve = merge({}, config.resolve, {
      alias: {
      Components: path.resolve(__dirname, 'components'),
      Libs: path.resolve(__dirname, 'libs'),
      Sagas: path.resolve(__dirname, 'sagas'),
      },
      });


      config.module.rules.push(
      {
      test: /.(css|scss)/,
      loader: 'emit-file-loader',
      options: {
      name: 'dist/[path][name].[ext]'
      }
      }
      ,
      {
      test: /.css$/,
      use: ['babel-loader', 'raw-loader', 'postcss-loader']
      }
      ,
      {
      test: /.css$/,
      loaders: [
      'style-loader',
      'css-loader'
      ]
      },
      {
      test: /.s(a|c)ss$/,
      use: ['babel-loader', 'raw-loader', 'postcss-loader',
      { loader: 'sass-loader',
      options: {
      includePaths: ['scss', 'node_modules','styles']
      .map((d) => path.join(__dirname, d))
      .map((g) => glob.sync(g))
      .reduce((a, c) => a.concat(c), )
      }
      }
      ]
      }
      )
      config.node = {
      fs: 'empty',
      };
      return config;
      },
      };


      There are a lot of solutions given on the StackOverflow for this problem, but none of them are working for me.



      I tried deactivating the Uglify plugin but that too is not working.










      share|improve this question















      I am working on a React JS project where I have used ActionHero as a server.
      On the localhost, everything is working fine, but when I tried to build the project locally I go this error message.



      vishal@vishal-pc:~/projects/x1-platform$ yarn run build
      yarn run v1.12.3
      warning package.json: No license field
      warning ../../package.json: No license field
      $ next build
      > Using external babel configuration
      > Location: "/home/vishal/projects/x1-platform/.babelrc"
      > Using "webpack" config function defined in next.config.js.
      > Failed to build on /tmp/c7a64326-b0fb-42d4-8537-3e83712fee01
      { Error: commons.js from UglifyJs
      Unexpected token: punc ()) [commons.js:83270,22]
      at /home/ampcome/projects/x1-platform/node_modules/next/dist/server/build/index.js:183:21
      at emitRecords.err (/home/ampcome/projects/x1-platform/node_modules/webpack/lib/Compiler.js:269:13)
      at Compiler.emitRecords (/home/ampcome/projects/x1-platform/node_modules/webpack/lib/Compiler.js:375:38)
      at emitAssets.err (/home/ampcome/projects/x1-platform/node_modules/webpack/lib/Compiler.js:262:10)
      at applyPluginsAsyncSeries1.err (/home/ampcome/projects/x1-platform/node_modules/webpack/lib/Compiler.js:368:12)
      at next (/home/ampcome/projects/x1-platform/node_modules/tapable/lib/Tapable.js:218:11)
      at Compiler.compiler.plugin (/home/ampcome/projects/x1-platform/node_modules/webpack/lib/performance/SizeLimitsPlugin.js:99:4)
      at Compiler.applyPluginsAsyncSeries1 (/home/ampcome/projects/x1-platform/node_modules/tapable/lib/Tapable.js:222:13)
      at Compiler.afterEmit (/home/ampcome/projects/x1-platform/node_modules/webpack/lib/Compiler.js:365:9)
      at require.forEach.err (/home/ampcome/projects/x1-platform/node_modules/webpack/lib/Compiler.js:354:15)
      at /home/ampcome/projects/x1-platform/node_modules/async/dist/async.js:473:16
      at iteratorCallback (/home/ampcome/projects/x1-platform/node_modules/async/dist/async.js:1064:13)
      at /home/ampcome/projects/x1-platform/node_modules/async/dist/async.js:969:16
      at /home/ampcome/projects/x1-platform/node_modules/graceful-fs/graceful-fs.js:45:10
      at FSReqWrap.oncomplete (fs.js:141:20)
      errors:
      [ 'commons.js from UglifyJsnUnexpected token: punc ()) [commons.js:83270,22]' ],
      warnings: }
      error Command failed with exit code 1.
      info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.


      next.config.js file



      const path = require('path');
      const merge = require('lodash.merge');
      const glob = require('glob')
      const Uglify = require('uglifyjs-webpack-plugin');
      module.exports = {
      webpack: (config) => {
      config.resolve = merge({}, config.resolve, {
      alias: {
      Components: path.resolve(__dirname, 'components'),
      Libs: path.resolve(__dirname, 'libs'),
      Sagas: path.resolve(__dirname, 'sagas'),
      },
      });


      config.module.rules.push(
      {
      test: /.(css|scss)/,
      loader: 'emit-file-loader',
      options: {
      name: 'dist/[path][name].[ext]'
      }
      }
      ,
      {
      test: /.css$/,
      use: ['babel-loader', 'raw-loader', 'postcss-loader']
      }
      ,
      {
      test: /.css$/,
      loaders: [
      'style-loader',
      'css-loader'
      ]
      },
      {
      test: /.s(a|c)ss$/,
      use: ['babel-loader', 'raw-loader', 'postcss-loader',
      { loader: 'sass-loader',
      options: {
      includePaths: ['scss', 'node_modules','styles']
      .map((d) => path.join(__dirname, d))
      .map((g) => glob.sync(g))
      .reduce((a, c) => a.concat(c), )
      }
      }
      ]
      }
      )
      config.node = {
      fs: 'empty',
      };
      return config;
      },
      };


      There are a lot of solutions given on the StackOverflow for this problem, but none of them are working for me.



      I tried deactivating the Uglify plugin but that too is not working.







      reactjs yarnpkg uglifyjs actionhero






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 21 at 19:21









      tk421

      3,32231426




      3,32231426










      asked Nov 21 at 5:42









      Vishal Shetty

      340217




      340217





























          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53405873%2factionhero-build-failing-with-unexpected-token-error%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53405873%2factionhero-build-failing-with-unexpected-token-error%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Sphinx de Gizeh

          Dijon

          Équipe cycliste