What is the purpose of being able to include additional scripts within package.json files?

I am attempting to include a new script in the package.json file under the scripts section. For instance, I have the following:

{
"scripts": {
    "delete": "rm -f wwwroot/*.js wwwroot/*.css wwwroot/*.html wwwroot/*.map"
    "watch": "npm run delete; parcel watch Client/index.html --out-dir wwwroot"
  }
}

However, when I execute npm run watch, an error is displayed in the terminal:


> <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="abdbd9c4c1cec8dfe5cac6ceeb9a859b859b">[email protected]</a> watch C:\Users\username\userProjectName\path\ProjectName
> npm run delete; parcel watch Client/index.html --out-dir wwwroot

npm ERR! missing script: delete;
npm ERR!
npm ERR! Did you mean this?
npm ERR!     delete

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\username\AppData\Roaming\npm-cache\_logs\2019-05-01T17_17_44_173Z-debug.lognpm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4535372a2f2026310b24282005746b756b75">[email protected]</a> watch: `npm run delete; parcel watch Client/index.html --out-dir wwwroot`
npm ERR! Exit status 1npm ERR!
npm ERR! Failed at the <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b4c4c6dbded1d7c0fad5d9d1f4859a849a84">[email protected]</a> watch script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\username\AppData\Roaming\npm-cache\_logs\2019-05-01T17_17_44_193Z-debug.log

Nevertheless, executing it manually by typing into the terminal:

npm run delete; parcel watch Client/index.html --out-dir wwwroot
, works as expected.

Answer №1

Just add a comma after the delete script and your code will be good to go.

{
"scripts": {
    "delete": "rm -f wwwroot/*.js wwwroot/*.css wwwroot/*.html wwwroot/*.map",
    "watch": "npm run delete; parcel watch Client/index.html --out-dir wwwroot"
  }
}

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

Error parsing module: Encountered unexpected token at line 7855, character 112

Currently, I am in the process of constructing a frontend application using npm run build via Jenkins. Unfortunately, I have encountered an error message as shown below. Can you provide guidance on how to resolve this issue? Creating an optimized productio ...

Exclude JSON entries that have null child elements

Here is the JSON data I have: { "id": 81, "bank_id": 2, "service_id": 1, "created_at": "2014-12-05 06:40:23", "updated_at": "2014-12-05 06:40:23", "alias": "remit", "alias_burmese": "remit", "reputation": null, "contact": null, "service": null }, { "id": ...

Using jsdom as a package in a Meteor application is not possible

Recently, I came across an issue with my packages.json file. It looks like this: { "jsdom" : "0.8.0", "request" : "2.25.0" } As part of my project, I have the following code snippet: if (Meteor.isServer) { Meteor.startup(function () { var _ ...

What could be causing the state to continuously appear as null in my redux application?

Currently, I am in the process of developing a basic contacts application to gain expertise in React and Redux. The main focus right now is on implementing the feature to add a new contact. However, I have encountered an issue where the state being passed ...

Challenges encountered when setting up Cordova and Ionic

After encountering an error while trying to install Cordova, a message appeared stating that PowerShell is not recognized. What could this mean and how can it be resolved? Several attempts have been made, such as adjusting the path in System variables &g ...

Turn off pagination for tables in Material-UI

Currently, I am utilizing the TablePagination component from Material-UI in my React project. Unfortunately, this component does not come with a built-in disabled prop. I do have a boolean variable called loading that I would like to utilize as a paramet ...

How does the interaction between Express and Angular for routing in the MEAN Stack function?

Currently, I am utilizing Express static to direct to the public directory. //app.js app.use(express.static( __dirname + '/public')); I am looking for a way to have most of the UI routing done by AngularJS. However, it seems that it only works ...

Managing an Infinite Amount of Inputs in React

I'm designing a React component that enables users to send emails to their friends and family. By default, the component includes 3 input fields, but users can easily add more by clicking a button. To implement this feature, I plan to create a button ...

Pug Template Not Displaying Emojis or Special Characters in Sendgrid Email Subject Line

There seems to be an issue with rendering emojis or special characters in the subject header of the pug file, although they work perfectly in the body. I have compiled both the body and subject header separately using pug. const compileHtmlFunction = pug.c ...

Should we retain the express variable for a specific purpose?

Being a developer who is still learning the ropes, I fail to understand the necessity of creating or retaining the express variable in an express/Node app. Instead of following this conventional approach: const express = require('express'); con ...

Issue: Headers cannot be set again once they have been sent during page reload

Whenever I attempt to refresh a specific page, I encounter an Error: Can't set headers after they are sent. Interestingly, when I click on a link to navigate to that page, the error doesn't occur. I have meticulously reviewed the sequence of even ...

Forwarding refs in React FC allows you to easily pass down

I have encountered an issue with references - I am trying to reference a function component and pass props to it. Currently, I have my Parent component and Child Component set up. In the parent component, I need to use a ref to access my child component. S ...

What options are available to enable the user to input information into the v-time-picker component?

I am looking for a solution where users can input digits into the vuetify v-time-picker, while still being able to select the time on the clock. <v-col align-self="center"> <v-menu ref="menuTimeStart" v-model="me ...

Issue with interactions between datepicker and jQuery dialog box

I am working with a datatable that displays user data, and each row has an edit button to open an edit form. I am opening this form using a jQuery dialog box and submitting it using ajax submit. However, when loading the form, the datepickers are not worki ...

Implementing dynamic props in Vue2 component by passing arbitrary named variables

Having recently delved into Vue, I am facing a challenge that has left me scratching my head after consulting the documentation: I am struggling to pass an arbitrarily named variable as a prop to a component instance. As per my understanding, props serve ...

Access the properties of a JSON object without specifying a key

I am dealing with a collection of JSON arrays structured like this: [ { team: 111, enemyId: 123123, enemyTeam: '', winnerId: 7969, won: 1, result: '', dat ...

Having trouble with the Keydown event - the image isn't moving as expected

Something seems off with my code. I have an image displayed on a canvas, but when I press the specified key, nothing happens. Can you help me figure out where I went wrong? let img = document.getElementById("ship"); let player = { x: 375, ...

Using npm and systemjs as a build tool in an Angular 2 app (RC 5): A step-by-step guide

While I am well-versed in using gulp and systemjs for bundling applications (such as utilizing compression, bundling, exporting to build folder, etc), my boss now requires just npm and systemjs to complete the task. I am unsure of how to create a custom sc ...

The hamburger menu on the navigation bar only functions the first time it is clicked

I've encountered an issue with my hidden menu nav bar. The hamburger and close buttons only work once. Should I organize the events within a function and call it at the end, or perhaps use a loop for the button events? It's worth noting that I d ...

What steps are involved in integrating OpenCV into a JavaScript project?

After recently installing OpenCV via npm using this guide: https://www.npmjs.com/package/opencv I'm facing a simple question. How can I actually utilize the OpenCV library in my project? The site provides a face detection example code snippet: cv.r ...