I'm encountering an issue with my NuxtJS build when using UglifyJS and node-rsa. Does anyone know how to fix

I have encountered an error while using the node-rsa library in my NuxtJS project. During the production build process with nuxt build, which includes JS and CSS minification by default, I receive the following message right before the build breaks:

ERROR in 0.nuxt.bundle.7c6932a7a42bdaaa7fa4.js from UglifyJs
Unexpected token: name (pem) [./~/node-rsa/src/formats/pkcs1.js:55,0][0.nuxt.bundle.7c6932a7a42bdaaa7fa4.js:42640,20]
Error: Webpack build exited with errors
    at /home/ubuntu/front-end/node_modules/nuxt/dist/nuxt.js:904:44
    ... (error stack continues)

To temporarily address this issue, I disabled UglifyJS as suggested in this solution. However, this is not a long-term fix. What would be the correct approach to resolve this problem?

This issue may be related to: Webpack breaks when i include node-rsa library

Answer №1

After encountering an issue, I realized that trying to implement a node library (not uglify-safe) directly on the browser without webpack was causing problems. To resolve this, I transitioned to utilizing pure JS for my encryption requirements and found that everything worked smoothly.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Using the built-in http module in node.js to upload images via multipart/form-data

I have encountered an issue where I need to send two images and an API key as part of a multipart/form-data HTTP request to an API. The images are retrieved from an AWS S3 bucket, which works fine. However, when attempting to send the image data as part ...

Why won't JavaScript functions within the same file recognize each other?

So I have multiple functions defined in scriptA.js: exports.performAction = async (a, b, c) => { return Promise.all(a.map(item => performAnotherAction(item, b, c) ) ) } exports.performAnotherAction = async (item, b, c) => { console.log(`$ ...

Issues with arguments not being identified - Discord.js version 14

After discovering that my arguments are no longer being recognized when executing a command, I encountered a strange issue. When args are not included, my console logs undefined, but if args are added, nothing is logged. This is snippet of my command hand ...

The socket.rooms value is updated before the disconnection listener finishes its process

When dealing with the "disconnect" listener, it's known that access to socket.rooms is restricted. However, I encountered an issue with my "disconnecting" listener. After making some modifications to my database within this callback, I attempted to em ...

What steps can I take to fix the 'module not found error' in webpack?

After setting up my ReactJS application with React-Bootstrap on Webpack 2, I encountered an error when trying to run it: ERROR in ./~/css-loader!./~/sass-loader/lib/loader.js!./app/css/bootstrap.css Module not found: Error: Can't resolve '../fon ...

Expanding the functionality of the app.get method in a Node.js application using Express

I'm facing an issue when trying to customize the behavior of app.get. It seems like some configurations are lost after extending it. In the code snippet below, both /sample and /es/sample return empty, while the expected output should be 'value& ...

What is the best way to create operating system-neutral file paths in Node.js?

I'm currently fixing issues with my code while running integration tests on an EC2 instance of a Windows machine. Despite resolving the filenames-are-too-long problem, several paths remain unresolved due to being hardcoded for UNIX systems. I've ...

Error Unhandled in Node.js Application

I have encountered an issue in my NodeJS application where I have unhandled code in the data layer connecting to the database. I deliberately generate an error in the code but do not catch it. Here is an example: AdminRoleData.prototype.getRoleByRoleId = ...

To combine arrays A and B within a React useState object, simply pass them as arguments when initializing the state

Currently, I am working on integrating infinite scroll functionality in React, where I need to fetch data from a backend API for loading content on the next page. The challenge I'm facing is that my state is set as an object using useState, and I need ...

Startling error: Our node server.js running into an unexpected token

I'm attempting to follow the Angular Universal quickstart, but I encountered an error when running "node server.js". Emily's-MBP:vepo Emily$ node server.js /Users/Emily/Development/vepo/server.js:3 import 'angular2-universal/polyfills&apos ...

What are the reasons for the dynamic exclusion of an element in Angular?

Can someone help me figure out why my data is not being added dynamically using ng-repeat? I have entered the "name" which should be added to the data, but it is not displaying in the UI. You can see the issue in this demo app.controller("studentcntr", ...

The Unexpected Flash: Troubleshooting an AJAX Request Gone Awry in CompoundJS

I am attempting to utilize the flash('error', 'error text') function in order to notify the webpage of any errors that may occur during an ajax request. The ajax request accesses an action that involves working with a database, making i ...

Mastering error handling in IcedCoffeeScript: Best practices and pro tips

When working with node.js, it is a common convention to return an error message as the first argument in a callback function. While there are several JavaScript solutions (such as Promise, Step, seq, etc) that address this issue, none of them seem to be co ...

Creating adaptable Object Properties using Zod

Just dipping my toes into Typescript, Zod, and Trpc. Let's say I have a schema for animals and plants. I want to keep all their shared properties in the main part of the schema, while putting more specific details into a sub-object named custom. (jus ...

Encountering a 404 error when attempting to make an Axios post request

Utilizing Axios for fetching data from my backend endpoint has been resulting in a 404 error. Oddly enough, when I manually enter the URI provided in the error message into the browser, it connects successfully and returns an empty object as expected. Her ...

Troubleshooting the Non-functioning req.value & ip with Node.js - Joi schema

I have implemented a joi schema to validate email and password that are sent as JSON in the request body. Now, I want to add an additional validation for the IP address. However, when I tried to do so, I encountered the following error: { "isJoi": tru ...

What are the steps for upgrading the Mongodb Nodejs driver to the newest version?

Can someone please provide guidance on how to easily update the mongodb nodejs driver to the latest version? I have attempted using only npm install mongodb, but it does not seem to upgrade to the most recent driver version. I am currently working in the ...

I am experiencing issues with the search feature in angular and node.js that is not functioning properly

Need assistance with debugging this code. I am currently working on adding search functionality to my Angular web page. However, when testing the code in Postman, I keep receiving the message "NO USER FOUND WITH USERNAME: undefined". Additionally, on the w ...

Guide on routing a websocket connection through a proxy server

Encountering an issue with github.com/facebook/create-react-app, particularly when proxying the webpack-dev-server with a custom server. While HTTP requests work fine, WebSocket requests fail with this specific error: WebSocket connection to 'ws://l ...

When trying to convert a function component to a class component, using `npm init react-app` may result in the error `ReferenceError: React is not defined no-undef`

After running npm init react-app appname, I noticed that the file App.js was created, containing a function component: function App() { return ( <SomeJSX /> ); } I decided to change this function component into a class component like this: c ...