npm ERR! missing script: setup - node.js

How can I resolve this error(When i use npm run setup)?
npm ERR! missing script: setup
This is my scripts in my package.json:
"scripts": {
"ng": "ng",
"start": "ionic serve",
"build": "ionic build",
"build:prod": "NODE_ENV=production ionic build --prod",
"build:test": "NODE_ENV=testing ionic build",
"dev:android": "ionic cordova run android --livereload",
"dev:ios": "ionic cordova run ios",
"prod:android": "NODE_ENV=production ionic cordova run android --prod",
"prod:ios": "NODE_ENV=production ionic cordova run ios --prod",
"test": "NODE_ENV=testing gulp && jest --verbose",
"test:ci": "NODE_ENV=testing gulp && jest -ci --runInBand --verbose",
"test:watch": "NODE_ENV=testing gulp watch & jest --watch",
"test:coverage": "NODE_ENV=testing gulp && jest --coverage",
"lint": "NODE_OPTIONS=--max-old-space-size=4096 ng lint",
"ionic:serve:before": "gulp",
"ionic:serve": "./scripts/serve.sh",
"ionic:build:before": "gulp"
}
My nvm version is: 0.38.0
My npm version is: 6.7.0
My node version is: v11.15.0
My system is macBook
Edit: This is the setup documentaion that I'm following

A script named setup does not exist in package.json for the latest release of moodleapp (v3.9.5).
However, version v3.9.4 of moodleapp does include the following setup script in package.json:
...
"scripts": {
...
"setup": "npm install && npx cordova prepare && npx gulp".
...
},
...
Perhaps the Setup the environment section of the docs is outdated.
Use version 3.9.4 of moodleapp instead.

I think your script is not serve but ionic:serve; So try running npm run ionic:serve

Related

Custom script in NPM package.json is ignored, runs as standalone

in my package.json I have these scripts:
"scripts":
{
"lint": "./node_modules/.bin/eslint src",
"build": "npm run clean && npm run dev && npm run prod",
"tsc": "./node_modules/.bin/tsc",
"dev": "./node_modules/.bin/webpack --config webpack.dev.js",
"prod": "./node_modules/.bin/webpack --config webpack.prod.js",
"clean": "del /q inet-henge*.js* dist",
"watch": "./node_modules/.bin/webpack --config webpack.dev.js --watch",
"postinstall": "copy inet-henge.js \"..\\flask\\customer_topology\\static\""
}
But for some reason postinstall is completely ignored when i run npm run build. When I run it as standalone script, it runs, the file is copied to the new location. Path is correct. What could be the problem, I am on Windows
post<x> runs after <x> so postinstall runs after install and if you want a script to run after build it should be called postbuild See https://docs.npmjs.com/cli/v6/using-npm/scripts for more details.

How to run multiple commands in a single package.json line with configuration

I want to run the to build commands (clienr and server) in one npm run commands.
So on my package.json scripts section I added this line:
"build-all": "ng build --prod && ng run web-app:server",
The problem occurs when I run this commands: npm run build-all --configuration=qa.europe.
The configuration is loaded when I run each commands separately but not when I run the above commands.
Any ideas?
You can try this.
"scripts": {
"start:production": "npm install && npm run build && npm run start:prod",
"start:prod": "cross-env NODE_ENV=production node server",
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
}
npm run start:production it will run "start:production" & "start:prod" both scripts
You can try to use postinstall, it will look as next:
"scripts": {
"start": "ng run web-app:server",
"postinstall": "ng build --prod --configuration=qa.europe",
}
So after npm install, the build of your UI starts. And after that will start your server.

Transpile using babel-preset-env without ejecting from create-react-app

I create a react project using create-react-app. And in order to pack it to run elsewhere, i use Docker with this config file:
My Dockerfile
FROM node
COPY package.json .
RUN npm install
COPY . .
RUN npm run build
RUN npm run transpile
CMD PORT=$PORT npm run start:prod
When i run my app inside docker using docker build . -t name_repo, the build stops at step 7/8 (npm run transpile) where i need to transpile the codes using babel (babel-preset-env and babel-preset-react-app) and got this error:
package.json:
...
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"transpile": "NODE_ENV=production babel src --out-dir transpiled --presets env,react-app",
"start:prod": "NODE_ENV=production node server.js"
},
...
I think Node_env is unlikely able to find the present name in the production configuration file . I would suggest please check all the parameters once again and use SET NODE_ENV =production

Restart debugging Node.js only after TSLint and TypeScript compilation are successful

I am trying to write a npm debug script such that when any source file is changed, tslint is executed, followed by tsc and finally node --inspect.
Currently, I have the following scripts in package.json:
"start": "node dist/app.js",
"start-debug": "node --inspect dist/app.js",
"build": "npm run tslint && npm run build-ts",
"tslint": "tslint -c tslint.json -p tsconfig.json",
"build-ts": "tsc",
"debug": "nodemon --exec \"(npm run build || exit 1) && npm run start-debug\""
The problem is that, when the lint process or compilation fails, the node.js instance is terminated. I would like to have the node.js instance restarted only when tslint and tsc exit successfully.
Any idea? Thanks.

Run npm build after beanstalk deploy

Anyone know how to get node AWS beanstalk to run npm run build command after its does its npm install.
I have the following scripts in my package.json but it doesn't seem to run the build or the start command just the install
"scripts": {
"build": "cross-env NODE_ENV=production webpack --config ./webpack/webpack.prod.config.js --progress --colors",
"start": "node server/app.js",
"dev": "nodemon server/app.js"
},

Resources