Executing the npm run test command with the unsafe-perm flag within the lifecycle phase

My React/Redux app is working fine, but whenever I run the command below:

npm run test

An error occurs as shown below:

6 info lifecycle [email protected]~test: [email protected]
7 verbose lifecycle [email protected]~test: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~test: PATH: C:\....\...
9 verbose lifecycle [email protected]~test: CWD: C:\projects\MyApp\MyApp\MyApp-web
10 silly lifecycle [email protected]~test: Args: [ '/d /s /c', 'mocha --require src/testSetup.js "src/**/*.test.js*" ' ]
11 silly lifecycle [email protected]~test: Returned: code: 1  signal: null
12 info lifecycle [email protected]~test: Failed to exec test script
13 verbose stack Error: [email protected] test: `mocha --require src/testSetup.js "src/**/*.test.js*" `
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:\....\NodeJs\12.1.0\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
13 verbose stack     at EventEmitter.emit (events.js:196:13)
13 verbose stack     at ChildProcess.<anonymous> (C:\....\NodeJs\12.1.0\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:196:13)
13 verbose stack     at maybeClose (internal/child_process.js:1000:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:267:5)

I'm unsure of what's causing this issue. Any suggestions on how to fix this error?

Answer №1

After some troubleshooting, I discovered that the root cause of my problem was related to the version of Node.js I had installed. To resolve this issue, I opted to leverage nvm (Node Version Manager) in order to seamlessly switch between different versions. By downgrading to version 11.13.0, I was able to successfully resolve the issue at hand.

Answer №2

Experiencing the same issue as well.

1: Try clearing the npm cache

npm cache clean --force

2: Ensure Node.js is updated to the latest version

3: Remove the node_modules folder and re-run npm install

4: If you encounter errors in the terminal, check for messages like -> Error: Cannot find module '@babel/core'

Try reinstalling the specific package mentioned.

Answer №3

After some troubleshooting, I found that setting nvm default to version 14 resolved the issue. nvm alias default 14 I suspect the problem may have arisen after a recent installation of nvm.

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

Exploring Angular 4.0: How to Loop through Numerous Input Fields

I am looking to loop through several input fields that are defined in two different ways: <input placeholder="Name" name="name" value="x.y"> <input placeholder="Description" name="description" value"x.z"> <!-- And more fields --> or lik ...

What is the best way to execute two queries and get back two objects in my route request?

I am interested in incorporating a second query call (using Mongoose for MongoDB) and returning the object in the same manner as I currently do with my Car object. Is there a method to execute the second query within the router so that both objects can b ...

Update the displayed locations on Google Maps by fetching and displaying marker data

I am able to retrieve and display information from my MySQL table, but I need assistance with refreshing this data every 5 seconds using my current code. The data being shown is not extensive, just about 5 or 8 markers at a time. Below is the code I curren ...

What is the best way to show unique content when a specific button is clicked from a group of buttons in Material UI and React?

Is there a way to show specific content when a particular button is clicked? I have three buttons named "BBQ", "Bilao", and "Chicken", each with their own unique content that should be displayed when the respective button is clicked. The issue I am facing ...

Tips for effectively utilizing innerHTML in this particular scenario

For an assignment, we were tasked with creating a Madlib game where users input words into textfields to replace certain words in a hidden paragraph within the HTML using JavaScript and CSS. The paragraph embedded in the HTML page is as follows: <span ...

Solving Shopify public app session conflicts: Tips and tricks

Recently, I developed a basic embedded public app on Shopify using Node.js for testing purposes. The app functions as expected but I encountered an issue with session clash when opening two stores in the same browser but in different tabs. For instance, ...

Automatically modify browser configurations to disable document caching

Is it possible to prevent browsers from caching pages using JavaScript? I've noticed that even though PHP has a redirection implemented once the user logs in, when they press the browser's history button, it goes back to the login form. This is b ...

Setting state back to default following the conditional rendering of a React component

Whenever the save button is clicked, I aim to display a snackbar component by updating the showSnackbar state to true. To achieve this in React, it's just a simple conditional check in the main render method. The snackbar I'm using here automatic ...

Passing a JSON object from one page to another using NextJS

I recently started working with NextJS and React. I've created a page called A where I fetch data (a JSON object) from an API using getServerSideProps() for each request and display it. On this page, I have some IconButtons that navigate to another pa ...

Learn the process of transmitting data from middleware to components and APIs in Next.js version 13

I've been experimenting with the Next Js 13 middleware feature and I'm a bit confused about how to pass data from the middleware to components/pages/api. For example, when trying to pass payload data or determine who the currently logged-in user ...

There was a failure to establish a Redis connection to the server with the address 127.0.0.1 on port 6379

Currently, I am working with node.js using expressjs. My goal is to store an account in the session. To test this out, I decided to experiment with sessions by following the code provided on expressjs var RedisStore = require('connect-redis')(ex ...

How to pass arguments to the `find` method in MongoDB collections

I've been attempting to pass arguments from a function to the MongoDB collection find method. Here's what I have so far: async find() { try { return await db.collection('users').find.apply(null, arguments); } catch(err) { c ...

What do you call the syntax %< ... >%?

Observed zoomInAnimation : true, zoomOutScale : false, templateLegend : "<ul class=\"<%=type.toLowerCase()%>-legend\"><% for (var j=0; j<sections.length; j++){%><li><span style=\"background-color:<%=section ...

Why does my ajax call always send a GET request instead of a POST?

$.ajax({ type:"post", url: server_url, dataType: "jsonp", jsonpCallback: callback, data:req_json, cache: false, timeout: 60000, success: succeeded, error: got_error }); I've ...

What is the best way to retrieve a png image using a Node.js Express app by sending a request to an API?

I am trying to retrieve a png image from an API endpoint using a nodejs express app. When attempting to fetch and display an image/svg file, everything works as expected. However, when I try the same with a png file, I receive poorly encoded text like thi ...

retrieve the coordinates of the northwest and southeast corners of a group of markers displayed on a Google Map

Is there a more efficient way to get the NE and SW corners of a set of markers on a Google map without iterating over each marker individually using JavaScript or Google functions? function fnSetBounds(){ var lowLat = 90; var highLat ...

What steps should I take to distribute files for an npm package publication?

I am looking to release an npm package that includes both my source files and distribution files. Within my GitHub repository, I have a src folder containing JavaScript source code. The build process generates a dist folder which holds the distribution fil ...

Tips for avoiding the influence of the parent div's opacity on child divs within a Primeng Carousel

I'm struggling to find a solution to stop the "opacity" effect of the parent container from affecting the child containers. In my code, I want the opacity not to impact the buttons within the elements. I have tried using "radial-gradient" for multipl ...

Whenever I try to initialize MyProject using react-native with version 0.58.6, I encounter an error message popping up

When attempting to create a new react native project with the command react-native init MyProject --version 0.58.6, I encounter an error every time. The error message is as follows: "Done in 80.32s." D:\MyProject\node_modules\metro-config&bs ...

The API is returning a successful response code of 200 when the HEAD and OPTIONS methods are utilized

My API is up and running smoothly with a GET method in express. This is the code for my API: app.get('/healthcheck', (_req, res) => { res.status(200).send({ state: 'Healthy', timestamp: new Date(), uptime: process.upti ...