NPM is having trouble locating a shell script

An error is encountered when running npm run build:

'.' is not recognized as an internal or external command, operable program or batch file.

Here is the npm file that contains relevant scripts:

"scripts": {
    "postinstall": "jspm install && npm run build",
    "start": "http-server",
    "build": "./bin/build-code",
    "build-home": "./bin/build-home -dw",
    "build-common-deps": "./bin/build-common-deps -dw",
    "build-navbar": "./bin/build-navbar -dw",
    "build-root": "./bin/build-root -dw",
    "build-angular1": "./bin/build-angular1 -dw",
    "build-react": "./bin/build-react -w",
    "build-preact": "./bin/build-preact -dw",
    "build-vanilla": "./bin/build-vanillajs",
    "build-angular2": "./bin/build-angular2 -dw"
}

The issue seems to be related to pathing for the ./bin/build-code script location. The expected behavior is the search for files from the same directory as the package.json. If there is a bin folder in that directory, then the correct path should lead to the build-code script within the bin folder. However, this doesn't seem to be working correctly. This problem persists whether using PowerShell or basic Command Prompt to execute npm run build.

P.S. A colleague also faced a similar issue on Cygwin and mentioned having to "Change dos endings to unix," although it remains unclear how this relates to the current problem.

Answer №1

It appears that npm is running batch scripts. Batch files are executed in CMD.exe (even when called from PowerShell), which does not interpret / as a path separator. This is why the error message is being generated.

To fix this issue, simply replace the forward slashes with \ (or \\ if they need to be escaped).

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

Constructing an Http Post URL with form parameters using the Axios HTTP client

I need assistance in creating a postHTTP request with form parameters using axios on my node server. I have successfully implemented the Java code for constructing a URL, as shown below: JAVA CODE: HttpPost post = new HttpPost(UriBuilder.fromUri (getPro ...

Create a default function within a mongoose field

Is there a way to achieve the following in my code: var categorySchema = new Schema({ id: { unique: true, default: function() { //set the last item inserted id + 1 as the current value. } }, name: String }); Can this be done? ...

What is the best way to "re-upload" drop-down selection using javascript?

I am attempting to automate a drop-down selection process on a website using a headless browser called Firefox Marionette. The website is not under my control, and the process involves: A primary drop-down menu where I can choose an option. A secondary dr ...

Steps to include a Target property in a freshly created MouseEvent

Trying to dispatch a contextMenu event, I've noticed that in the MouseEvent interface for TypeScript, the target property is missing, even though it is documented in the contextMenu documentation. Here's my TypeScript snippet: const emulatedMou ...

Leveraging body-parser for capturing an indefinite amount of text fields in node/express

Background In pursuit of my Free Code Camp back end certification, I am embarking on the task of creating a voting application. For detailed information and user stories required for this project, visit this link: Among the user stories is the ability to ...

Is there a way to automatically update the input value when I refresh the page following a click event?

Currently, I have multiple p elements that trigger the redo function upon being clicked. When a p element is clicked, the quest[q] template is loaded onto the .form div. These templates are essentially previously submitted forms that sent values to an obj ...

Why is the script from URL "http://.../js/myscript.js" not executing as expected after being fetched?

Is it possible to have the server run a JavaScript file specified in a URL, such as "http://.../js/script_name.js", and return the result instead of just displaying the source code? I am assuming that the server is using node.js. ...

Displaying queries using ajax in Rails

Can someone assist me in dealing with a particular issue? I am using ajax to refresh queries from the database dynamically each time there is a change in a search form. The main objective is to load N number of records based on the parameters selected in ...

Setting up the data for the AjaxAppender Request Log4Javascript

I am completely new to Log4Javascript and the concept of logging, so please bear with me. My current task involves sending logs to a CouchDB server using a POST request. However, I keep encountering an error from the server: {"error":"bad_request","reaso ...

Internet Explorer IE 11 encounters an "Error: Object does not support property or method" issue

Recently, I started using the jquery circleChart.min.js plugin for creating a circle chart. It's been working perfectly on all browsers except for Internet Explorer 11 (IE11). I keep getting an error message when trying to run it in IE11. Can anyone h ...

What is the best way to distinguish between inline javascript and dynamically created content in Express/Node.js?

I've encountered a bit of a noob-question despite having a few years of experience in web development. Despite searching Programmer Stack Exchange and Google, I haven't found an answer, so here goes. Currently, I'm working with the Express ...

Oops! There was an error when trying to read the package.json file. It seems like the file '/client/package.json' cannot be found

Hey everyone, I'm fairly new to the world of coding and currently facing a bit of a roadblock. I made some updates to my project but when I tried re-deploying it, things didn't go as smoothly as planned. My setup includes React version 18 and Nod ...

webpack-dev-server has finished with exit code 1

Within my project, I have split up the webpack configuration into three separate files: webpack.config.base, webpack.config.dev, and webpack.config.prod. Each file contains specific code tailored to its purpose: webpack.config.base const webpack = requir ...

I am curious about the inner workings of the `createApplication()` function in the ExpressJS source code. Can you shed some light on

My goal is to deeply comprehend the inner workings of the Express library, step by step. From what I gather, when we import and invoke the 'express()' function in our codebase, the execution flow navigates to the ExpressJS library and searches fo ...

Guide on extracting faulty image links using JavaScript and transferring them to PHP

I have a website that showcases numerous external images and thumbnails, often exceeding 100 on a single page. These image URLs are crawled, indexed, stored in a MySQL database, and later displayed using a simple loop code from queries. <img src="<? ...

How can you transform the outcome of a TYPO3 repository search into a JSON format?

Is it possible to convert the outcome of a "findAll()" function on a Repository into a JSON object, make changes to specific properties in JavaScript, and then send it back to the Action, converting it again for use by the Action to persist it in the datab ...

Exploring the intricacies of initializing a JavaScript function

I recently inherited a large JavaScript file from a previous developer, and I'm trying to decipher some of the key sections. Here is the complete code: $(function () { var homepage = (function () { // Main functionalities are defined he ...

What is the process for appending a value to an array of JSON objects?

I have a JSON array containing objects which I need to pass the values to the DataTables. [{ _id: '58a2b5941a9dfe3537aad540', Country: 'India', State: 'Andhra Pradesh', District: 'Guntur', Division: ...

Storing a dynamically created grid of inputs using a consistent ng-model

I have the following code snippets: $scope.createPack = function(informationsPack, informationsActivite) { PackService.add(informationsPack, informationsActivite) .then(function(res) { $state.go(&apos ...

Steer your keyboard attention towards the parent element that embodies a list

My implementation focuses on making drop down menus accessible via keyboard input using HTML/CSS and JS/jQuery events. The goal of keyboard accessibility includes: Tab key to navigate the menu elements. Pressing the down arrow key opens a focused menu. ...