Encountering an issue with launching npm serve on MacOS while using IntelliJ Ultimate for a Vue.js project

I can't seem to get npm serve to start in the Run/Debug Configuration within IntelliJ.
However, when I run it separately in the Terminal within IntelliJ or on the regular console, it works just fine.

Any idea what's causing this and how to fix it?

Here's the output from the Run console:

/usr/local/bin/node /usr/local/lib/node_modules/npm/bin/npm-cli.js run serve --scripts-prepend-node-path=auto

> [email protected] serve
> node_modules/.bin/vue-cli-service serve

env: node: No such file or directory

Process finished with exit code 127

Just as a reminder, running the command

/usr/local/bin/node /usr/local/lib/node_modules/npm/bin/npm-cli.js run serve --scripts-prepend-node-path=auto

in the terminal works correctly, even within IntelliJ.

In my IntelliJ Preferences under Languages & Frameworks/Node.js and NPM, the Node interpreter is set to /usr/local/bin/node and the Package manager is set to /usr/local/lib/node_modules/npm. Both paths do exist.

Can someone please shed some light on this issue?
I'm eager to gain a deeper understanding of the situation and truly appreciate any insights.

Answer №1

The main issue here is that the node executable is not included in your system's $PATH. In MacOSX, there are different environment variables for GUI applications and terminal sessions. The terminal environment is only accessible to applications launched from the terminal itself. To address this issue, IDEA attempts to load the terminal environment by running certain scripts during startup. However, it seems that in your case, it is unable to retrieve all the necessary components, leading to the problem at hand. As a temporary fix, you can try launching IDEA from the terminal.

Here are some helpful links: , . It's worth noting that defining system-wide environment variables on Mac can vary between different versions (even minor updates can disrupt your setup).

Answer №2

Thanks to john for the helpful tip provided! Your input was greatly appreciated. Running from the command line did the trick.

In my scenario, I created a simple startup script

#! /bin/bash
/Applications/Visual\ Studio\ Code.app/Contents/MacOS/code &

I am currently using the professional version of Visual Studio Code. The community edition has a different launch path!

A couple of enhancements I would like are

  • automatic closure of the terminal window upon execution
  • an easy shortcut icon on the desktop for quick access.

If anyone has suggestions or solutions, feel free to share! :-)

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

leveraging dependency injection to retrieve a function in JavaScript

I'm exploring a way to obtain a function in JavaScript without executing it, but still defining the parameters. My current project involves creating a basic version of Angular's dependency injection system using Node.js. The inject() method is us ...

The creation of package.json did not involve the use of npm init command

When I run the npm init command within the terminal, the package.json file doesn't appear in the folder where I expected it to be located. However, when I use the dir command, it shows that the package.json file has actually been created. For more inf ...

Error: Docker daemon failed to create OCI runtime

I'm in the process of setting up Docker for my Node.js and TypeScript project, but I encountered an error when trying to run docker-compose run --service-ports web. Here's what my composer file looks like: services: web: image: node:alpin ...

The command "ng new" failed to execute properly, resulting in a blank terminal screen appearing

Attempting to start my first Angular project has hit a snag right from the beginning. Upon navigating to the project folder and entering the command: ng new my-first-project I am met with nothing but a blank terminal screen: https://i.stack.imgur.com/eH ...

What is the proper way to incorporate a URL query into a path within the Vue.js router?

Template Component.vue utilizes the route in this manner: <router-link :to="{ name: 'club' }"> <lazy-image src="club.jpg" class="club_class" alt="Club alt" /> </router-link> ...

Attempting to automatically invoke the API every minute, rather than relying on the user to reload the page

I currently have fetchCoins() in my mounted() function, which calls the API whenever a user refreshes. My goal is to call the API once, store the data in local storage, and then retrieve the data every minute. methods: { async fetchCoins() { con ...

How do I go about transferring data from an excel sheet to an external API with the help of JQuery/Node.js?

If I possess an excel document that needs to be delivered to an API endpoint which demands the following headers: Content-Type: multipart/form-data Content-Disposition: form-data; name="fileData"; filename="Form_SOMETHING(2).xlsx" Is it plausible for me ...

Immediately after setting up a fresh Angular 13 project, addressing the npm ERR! regarding the missing peer dependency ajv@^6.9.1 requested by [email protected]

Recently, I initialized a fresh Angular project by running npx @angular/cli@13 new Ubisoft.SupplierPortalNext.Spa and then performed npm install, which resulted in the following warning: npm WARN [email protected] requires a peer of ajv@^6.9.1 but n ...

Bypass ESLint rule when using Uglify in the Vue build script like a pro!

Every time I try to execute npm run build, I encounter a consistent punc error in various lines. The issue seems to be related to the method in which I am defining functions within my components: <script> export default { data() {} } </scrip ...

Storing data in a TypeBuffer and then retrieving it from a file can lead to surprising outcomes

Upon executing the following code: var list = new Uint32Array(16); for (var i=0; i<16; ++i) list[i] = i; fs.writeFileSync("list", new Uint8Array(list).buffer); console.log([].slice.call(new Uint32Array(fs.readFileSync("list")))); We anticipate the out ...

When running npm test in Angular 12, an error message pops up saying "Failed to load color version"

After transitioning our application from angular 6 to 12, everything seemed fine as I was able to successfully run the application using 'npm start' and test its UI features. However, upon attempting to run my angular unit tests with 'npm ru ...

Why does Vue 3 template display 101 instead of 1 when incrementing the number from 0?

Vue.createApp({ data() { return { counter: 0 } }, template: '<div>{{counter++}}</div>' }).mount('#root') Ultimately, the code above displays the number 101 on the page. Any insights into why this is happ ...

Pattern for identifying JavaScript import declarations

My task involves using node to read the contents of a file. Specifically, I am looking to identify and extract a particular import statement within the file that includes the "foo-bar" package. The goal is to match only the line or lines that contain the ...

Send a quick response and retrieve it in the client application

My goal is to allow the user to send data to the server, where it will be saved into a database. After this process, I want to send a message back to the user (which could include the ID of the newly added object). However, I have been struggling with my c ...

Running NodeJS scripts with ElectronJS is not possible

Goal I'm facing a challenge with executing my separate scripts located in the project/api folder. Let's take test.js as an example, where I am exporting it using module.exports. When I run my electron window and create a JavaScript file with a f ...

Leveraging environment variables within package.json

Working on an older application, I've encountered a challenge where the API endpoint URL varies depending on the system. Currently, my package.json file looks like this: "start": "cross-env API_ENDPOINT=http://localhost:5000/api/v1 react-scripts sta ...

What is the best way to export an SVG node to a file using Node.js?

I've integrated d3 into my project with the help of a convenient package called https://www.npmjs.com/package/d3-node Using d3-node, I generated an svg file and here's the code snippet. const D3Node = require('d3-node') var d3n = new ...

An issue has been encountered with the Shopify package while trying to create a Client instance

Looking for help with importing the Shopify API from NPM and setting up the client without encountering errors. Here is the code snippet: import Shopify from '@shopify/shopify-api'; const client = new Shopify.Clients.Rest('store_name_here.m ...

The function batchWriteItem() has been known to produce unpredictable outcomes

Currently in my Node.js project, I am attempting to write records to a DynamoDB table using the batchWriteItem() method. When I call the insertTransactionDetails() function for the first time, I send 9 records to be inserted. On the second call to the sam ...

Is it possible to implement React Native authentication by utilizing Express sessions?

I currently have a web application that utilizes React on the frontend and Express sessions on the backend for authentication and authorization. I'm interested in exploring if I can apply a similar approach to authenticate mobile users. In my web appl ...