NPM Installation Failed With Laravel 8 - node.js

I want to run npm run dev command on my Laravel 8 project, but I get this error:
[webpack-cli] Error: Unknown option '--hide-modules'
[webpack-cli] Run 'webpack --help' to see available commands and options
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! # development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpa
ck.config.js`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the # development 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\User 1\AppData\Roaming\npm-cache\_logs\2021-07-03T05_59_56_150Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! # dev: `npm run development`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the # dev 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\User 1\AppData\Roaming\npm-cache\_logs\2021-07-03T05_59_56_264Z-debug.log
My package.json goes like this:
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "npm run development -- --watch",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"#fortawesome/fontawesome-free": "^5.15.1",
"axios": "^0.21.1",
"bootstrap": "^4.5.2",
"jquery": "^3.5.1",
"laravel-mix": "^4.1.4",
"lodash": "^4.17.20",
"node-sass": "^4.14.1",
"popper.js": "^1.16.1",
"resolve-url-loader": "^2.3.1",
"sass": "^1.29.0",
"sass-loader": "^7.3.1",
"vue": "^2.6.12",
"vue-template-compiler": "^2.6.12",
"webpack": "^4.44.2",
"webpack-cli": "^4.7.2"
},
"dependencies": {
"#fancyapps/fancybox": "^3.5.7",
"#wiris/mathtype-tinymce5": "^7.24.1",
"bootstrap-fileinput": "^5.1.3",
"chosen-js": "^1.8.7",
"copy-to-clipboard": "^3.3.1",
"counterup2": "^1.0.4",
"croppie": "^2.6.5",
"font-awesome": "^4.7.0",
"highcharts": "^8.2.0",
"jquery-clock-timepicker": "^2.3.2",
"num2persian": "^3.2.2",
"production": "0.0.2",
"select2": "^4.0.13",
"simplebar": "^5.3.0",
"slick-carousel": "^1.8.1",
"sweetalert2": "^8.19.0",
"tinymce": "^5.5.1",
"tooltipster": "^4.2.8"
}
}
I tried deleting node_modules folder and again run the command npm install and npm run dev but didn't solve the issues.

At the very least, the latest version of Laravel 8 has a change to the scripts section in package.json to utilize the updated version of Laravel Mix.
Try this in your package.json.
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "mix",
"watch": "mix watch",
"watch-poll": "mix watch -- --watch-options-poll=1000",
"hot": "mix watch --hot",
"prod": "npm run production",
"production": "mix --production"
},
"devDependencies": {
"#fancyapps/fancybox": "^3.5.7",
"#fortawesome/fontawesome-free": "^5.15.3",
"#wiris/mathtype-tinymce5": "^7.26.1",
"axios": "^0.21.1",
"bootstrap": "^5.0.2",
"bootstrap-fileinput": "^5.2.2",
"chosen-js": "^1.8.7",
"copy-to-clipboard": "^3.3.1",
"counterup2": "^1.0.4",
"croppie": "^2.6.5",
"highcharts": "^9.1.2",
"jquery": "^3.6.0",
"jquery-clock-timepicker": "^2.4.0",
"laravel-mix": "^6.0.25",
"lodash": "^4.17.21",
"node-sass": "^6.0.1",
"num2persian": "^3.2.2",
"popper.js": "^1.16.1",
"postcss-import": "^14.0.2",
"production": "0.0.2",
"resolve-url-loader": "^4.0.0",
"sass": "^1.35.1",
"sass-loader": "^12.1.0",
"select2": "^4.0.13",
"simplebar": "^5.3.4",
"slick-carousel": "^1.8.1",
"sweetalert2": "^11.0.18",
"tailwindcss": "^2.2.4",
"tinymce": "^5.8.2",
"tooltipster": "^4.2.8",
"vue": "^2.6.14",
"vue-template-compiler": "^2.6.14",
"webpack": "^5.42.0",
"webpack-cli": "^4.7.2"
}
}

Frist new install npm.
npm install
Please run the command.
npm i vue-loader
Now this command run.
npm run dev

Related

Why i receive error message while install typeorm?

I tried to build my project with Jenkins.
Node version: 16.16.0
Npm version: 8.11.0
Env: Ubuntu 20.04.4 LTS
Jenkins pulled git repo and tried to install dependencies.
I installed nodejs plugin to jenkins.
If i tried run npm i manually from /var/lib/jenkins/workspace it shows me same error log.
npm i working correctly on my local machine (Windows 10)
Also i tried to re-install node and npm with versions from my local machine, but nothing happened :(
My error log:
00:07:51 npm ERR! code ERESOLVE
00:07:51 npm ERR! ERESOLVE could not resolve
00:07:51 npm ERR!
00:07:51 npm ERR! While resolving: #nestjs/typeorm#8.0.3
00:07:51 npm ERR! Found: typeorm#0.3.6
00:07:51 npm ERR! node_modules/typeorm
00:07:51 npm ERR! typeorm#"^0.3.6" from the root project
00:07:51 npm ERR!
00:07:51 npm ERR! Could not resolve dependency:
00:07:51 npm ERR! peer typeorm#"^0.2.34" from #nestjs/typeorm#8.0.3
00:07:51 npm ERR! node_modules/#nestjs/typeorm
00:07:51 npm ERR! #nestjs/typeorm#"^8.0.3" from the root project
00:07:51 npm ERR!
00:07:51 npm ERR! Conflicting peer dependency: typeorm#0.2.45
00:07:51 npm ERR! node_modules/typeorm
00:07:51 npm ERR! peer typeorm#"^0.2.34" from #nestjs/typeorm#8.0.3
00:07:51 npm ERR! node_modules/#nestjs/typeorm
00:07:51 npm ERR! #nestjs/typeorm#"^8.0.3" from the root project
00:07:51 npm ERR!
00:07:51 npm ERR! Fix the upstream dependency conflict, or retry
00:07:51 npm ERR! this command with --force, or --legacy-peer-deps
00:07:51 npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
00:07:51 npm ERR!
00:07:51 npm ERR! See /var/lib/jenkins/.npm/eresolve-report.txt for a full report.
00:07:51
00:07:51 npm ERR! A complete log of this run can be found in:
00:07:51 npm ERR! /var/lib/jenkins/.npm/_logs/2022-07-20T21_07_43_903Z-debug-0.log
package.json file:
{
"name": "teach-me-grow",
"version": "0.0.1",
"description": "",
"author": "",
"private": true,
"license": "UNLICENSED",
"scripts": {
"prebuild": "rimraf dist",
"build": "nest build",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"start": "nest start",
"start:dev": "nest start --watch",
"start:debug": "nest start --debug --watch",
"start:prod": "node dist/main",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
"test": "jest",
"test:watch": "jest --watch",
"test:cov": "jest --coverage",
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
"test:e2e": "jest --config ./test/jest-e2e.json"
},
"dependencies": {
"#nestjs/common": "^8.0.0",
"#nestjs/core": "^8.0.0",
"#nestjs/passport": "^8.2.1",
"#nestjs/platform-express": "^8.0.0",
"#nestjs/swagger": "^5.2.1",
"#nestjs/typeorm": "^8.0.3",
"class-validator": "^0.13.2",
"connect-typeorm": "^1.1.4",
"dotenv": "^16.0.1",
"express-session": "^1.17.3",
"module-alias": "^2.2.2",
"passport": "^0.5.3",
"passport-facebook": "^3.0.0",
"passport-google-oauth20": "^2.0.0",
"passport-local": "^1.0.0",
"pg": "^8.7.3",
"pg-hstore": "^2.3.4",
"reflect-metadata": "^0.1.13",
"rimraf": "^3.0.2",
"rxjs": "^7.2.0",
"swagger-ui-express": "^4.4.0",
"typeorm": "^0.3.6"
},
"devDependencies": {
"#nestjs/cli": "^8.0.0",
"#nestjs/schematics": "^8.0.0",
"#nestjs/testing": "^8.0.0",
"#types/express": "^4.17.13",
"#types/jest": "27.5.0",
"#types/node": "^16.0.0",
"#types/supertest": "^2.0.11",
"#typescript-eslint/eslint-plugin": "^5.0.0",
"#typescript-eslint/parser": "^5.0.0",
"eslint": "^8.0.1",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^4.0.0",
"jest": "28.0.3",
"prettier": "^2.3.2",
"source-map-support": "^0.5.20",
"supertest": "^6.1.3",
"ts-jest": "28.0.1",
"ts-loader": "^9.2.3",
"ts-node": "^10.0.0",
"tsconfig-paths": "4.0.0",
"typescript": "^4.3.5"
},
"jest": {
"moduleFileExtensions": [
"js",
"json",
"ts"
],
"rootDir": "src",
"testRegex": ".*\\.spec\\.ts$",
"transform": {
"^.+\\.(t|j)s$": "ts-jest"
},
"collectCoverageFrom": [
"**/*.(t|j)s"
],
"coverageDirectory": "../coverage",
"testEnvironment": "node"
},
"_moduleAliases": {
"#app": "./dist"
}
}
Looking on nestjs/typeorm in version 8.0.3 it has fixed version of typeorm package in its dependencies (package.json: https://github.com/nestjs/typeorm/blob/8.0.3/package.json)
If you want to stick to nestjs/typeorm 8.0.3 version lower your typeorm version to 0.2.45 or upgrade nestjs/typeorm version to one which uses newer typeorm version

node-gyp-build not found when Deploying web3 App to heroku

I'm attempting to deploy a web3 application to heroku, but while building the npm dependencies, I get the following error:
remote: sh: 1: node-gyp-build: not found
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! syscall spawn
remote: npm ERR! file sh
remote: npm ERR! errno ENOENT
remote: npm ERR! bufferutil#4.0.3 install: `node-gyp-build`
remote: npm ERR! spawn ENOENT
remote: npm ERR!
remote: npm ERR! Failed at the bufferutil#4.0.3 install script.
I believe this is because of the web3#1.3.6 dependency I am adding. If I leave this out of the npm dependencies in my package.json file, the deploy works successfully.
If I ssh into a console, I'm able to run npm install -g web3#1.3.6 and that is also successful. I've also tried adding node-gyp, node-gyp-build, and bufferutil as explicit dependencies in the package.json file. I'm using
node 14.17.0
npm 6.14.13
python 3.9.5
Below is my full package.json file
{
"engines": {
"node": "14.17.0",
"npm": "6.14.13"
},
"repository": {},
"description": " ",
"license": "MIT",
"scripts": {
"deploy": "webpack --mode production",
"watch": "webpack --mode development --watch"
},
"dependencies": {
"postcss": "8.1.0",
"#popperjs/core": "^2.9.2",
"bootstrap": "^5.0.1",
"jquery": "^3.6.0",
"phoenix": "file:../deps/phoenix",
"phoenix_html": "file:../deps/phoenix_html",
"phoenix_live_view": "file:../deps/phoenix_live_view",
"topbar": "^0.1.4",
"#babel/core": "^7.0.0",
"babel-polyfill": "^6.26.0",
"#babel/preset-env": "^7.0.0",
"babel-loader": "^8.0.0",
"css-loader": "^5.2.6",
"sass-loader": "^10.0.0",
"node-sass": "^6.0.0",
"cropperjs": "1.5.12",
"eth-sig-util": "^1.4.2",
"jquery-cropper": "1.0.1",
"copy-webpack-plugin": "^5.1.1",
"hard-source-webpack-plugin": "^0.13.1",
"mini-css-extract-plugin": "^0.9.0",
"optimize-css-assets-webpack-plugin": "^5.0.1",
"terser-webpack-plugin": "^2.3.2",
"webpack": "^4.41.5",
"webpack-cli": "^3.3.2",
"web3": "1.3.6"
},
"devDependencies": {},
}

Npm prepublish script webpack not found

I am trying to modify a npm module and I want to include the modified module as a local dependency.
When deploying this app on hosting, I am facing a strange webpack not found problem. I managed to reproduce the problem in my local machine by removing webpack globally.
My package.json:
1) I try to include the local module in package.json dependencies:
{
"name": "parse-server-example",
"version": "1.4.0",
"description": "An example Parse API server using the parse-server module",
"main": "index.js",
"repository": {
"type": "git",
"url": "https://github.com/ParsePlatform/parse-server-example"
},
"license": "MIT",
"dependencies": {
"webpack": "2.3.3",
"express": "~4.11.x",
"kerberos": "~0.0.x",
"parse": "~1.8.0",
"parse-dashboard-simple": "./parse-dashboard-simple",
"parse-server": "*"
},
"scripts": {
"start": "node index.js"
},
"engines": {
"node": "7.6.0"
}
}
Take note that I have a local module called "./parse-dashboard-simple".
My local module's package.json:
{
"name": "parse-dashboard",
"parseDashboardFeatures": [
"Data Browser",
"Cloud Code Viewer",
"Cloud Code Jobs Viewer and Runner",
"Parse Config",
"API Console",
"Class Level Permissions Editor",
"Pointer Permissions Editor",
"Send Push Notifications",
"Logs Viewer",
"Push Status Page",
"Relation Editor"
],
"description": "The Parse Dashboard",
"keywords": [
"parse",
"dashboard"
],
"homepage": "https://github.com/ParsePlatform/parse-dashboard",
"bugs": "https://github.com/ParsePlatform/parse-dashboard/issues",
"version": "1.0.25",
"repository": {
"type": "git",
"url": "https://github.com/ParsePlatform/parse-dashboard"
},
"license": "SEE LICENSE IN LICENSE",
"files": [
"Parse-Dashboard",
"bin",
"README.md",
"LICENSE"
],
"dependencies": {
"bcryptjs": "^2.3.0",
"body-parser": "^1.15.2",
"commander": "^2.9.0",
"connect-flash": "^0.1.1",
"cookie-session": "^2.0.0-alpha.1",
"csurf": "^1.9.0",
"express": "^4.13.4",
"json-file-plus": "^3.2.0",
"package-json": "^2.3.1",
"passport": "^0.3.2",
"passport-local": "^1.0.0",
"webpack": "~1.12.0"
},
"devDependencies": {
"babel-core": "~5.8.12",
"babel-loader": "~5.3.0",
"babel-plugin-remove-proptypes": "~1.0.0",
"babel-polyfill": "^6.7.2",
"babel-runtime": "~5.8.25",
"css-loader": "~0.18.0",
"file-loader": "^0.8.5",
"history": "^2.1.2",
"http-server": "~0.8.5",
"immutable": "~3.7.5",
"immutable-devtools": "~0.0.4",
"jest-cli": "^12.0.2",
"js-beautify": "~1.5.0",
"marked": "^0.3.5",
"node-sass": "^3.7.0",
"parse": "1.6.14",
"prismjs": "~1.2.0",
"react": "^15.0.1",
"react-addons-test-utils": "^15.0.1",
"react-dnd": "~2.1.4",
"react-dnd-html5-backend": "~2.0.0",
"react-dom": "^15.0.1",
"react-router": "^2.6.0",
"request-promise": "^4.1.1",
"sass-loader": "~3.1.2",
"style-loader": "~0.12.3",
"svg-prep": "~1.0.0",
"transform-jest-deps": "^2.1.0",
"webpack": "~1.12.0"
},
"scripts": {
"dev": "node ./Parse-Dashboard/index.js & webpack --config webpack/build.config.js --devtool eval-source-map --progress --watch",
"dashboard": "node ./Parse-Dashboard/index.js & webpack --config webpack/build.config.js --progress --watch",
"pig": "http-server ./PIG -p 4041 -s & webpack --config webpack/PIG.config.js --progress --watch",
"build": "NODE_ENV=production webpack --config webpack/production.config.js && webpack --config webpack/PIG.config.js",
"test": "NODE_PATH=./node_modules jest",
"generate": "node scripts/generate.js",
"prepublish": "webpack --config webpack/publish.config.js",
"start": "node ./Parse-Dashboard/index.js"
},
"bin": {
"parse-dashboard": "./bin/parse-dashboard"
},
"engines": {
"node": "7.6.0"
},
"main": "Parse-Dashboard/app.js",
"jest": {
"testPathDirs": [
"src/lib"
],
"scriptPreprocessor": "<rootDir>/testing/preprocessor.js",
"testDirectoryName": "tests",
"testFileExtensions": [
"test.js"
],
"unmockedModulePathPatterns": [
"react",
"react-dom",
"react-addons-test-utils",
"fbjs"
]
}
}
If I run "npm install" at the root level of this project, I will get this error:
npm WARN prepublish-on-install As of npm#5, `prepublish` scripts will run only for `npm publish`.
npm WARN prepublish-on-install (In npm#4 and previous versions, it also runs for `npm install`.)
npm WARN prepublish-on-install See the deprecation note in `npm help scripts` for more information.
> parse-dashboard#1.0.25 prepublish /mypath/-dashboard-advanced
> webpack --config webpack/publish.config.js
sh: webpack: command not found
npm ERR! addLocal Could not install /mypath/-dashboard-advanced
npm ERR! addLocal Could not install /mypath/-dashboard-simple
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! Darwin 16.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v7.6.0
npm ERR! npm v4.1.2
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! parse-dashboard#1.0.25 prepublish: `webpack --config webpack/publish.config.js`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the parse-dashboard#1.0.25 prepublish script 'webpack --config webpack/publish.config.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the parse-dashboard package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! webpack --config webpack/publish.config.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs parse-dashboard
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls parse-dashboard
npm ERR! There is likely additional logging output above.
So my understanding is that the webpack is needed in prepublish script but it is not found. But I have intentionally added webpack as dependencies in both root project or the local module (in both dev and production dependencies just to be safe), why is webpack still not found?

npm scripts in package.json errors on exit

I'm able to run my scripts successfully, however, when i exit (ctrl + c) I get a loud error from the eslint, or jest jobs that were watching. Is there a means of suppressing these, as I get errors from the package themselves when the tests or linting fails
Example error:
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/Cellar/node/7.5.0/bin/node" "/usr/local/bin/npm" "run" "lint"
npm ERR! node v7.5.0
npm ERR! npm v4.1.2
npm ERR! code ELIFECYCLE
npm ERR! wpauth#1.0.0 lint: `esw webpack.config.* src tools --color`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the wpauth#1.0.0 lint script 'esw webpack.config.* src tools --color'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the wpauth package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! esw webpack.config.* src tools --color
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs wpauth
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls wpauth
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/gazzwi86/Sites/tokenauth/npm-debug.log
Package.json
{
"name": "wpauth",
"version": "1.0.0",
"scripts": {
"start": "npm run start:dev",
"start:dev": "npm-run-all --parallel test:watch lint:watch serve:dev open:dev",
"start:dist": "npm-run-all build open:dist serve:dist",
"prebuild": "rm -r src/main/webapp/public/secure-me && mkdir src/main/webapp/public/secure-me && npm run test && npm run lint",
"build": "webpack -p --define process.env.NODE_ENV='\"production\"' --optimize-minimize && cp ./src/ui/index.html src/main/webapp/public/secure-me/",
"lint": "esw webpack.config.* src tools --color",
"lint:watch": "npm run lint -- --watch",
"test": "jest",
"test:watch": "npm run test -- --watch",
"open:dev": "open http://localhost:8080/webpack-dev-server/",
"open:dist": "open http://localhost:8080/",
"serve:dev": "webpack-dev-server --progress --colors --content-base src/ui",
"serve:dist": "http-server src/main/webapp/public/secure-me"
},
"jest": {
"moduleNameMapper": {
"\\.(css|scss)$": "identity-obj-proxy",
"^.+\\.(gif|ttf|eot|svg|woff|woff2|ico)$": "<rootDir>/fileMock.js"
}
},
"dependencies": {
"backbone": "^1.3.3",
"jquery": "^2.2.4",
"react": "^15.4.2",
"react-dom": "^15.4.2",
"underscore": "^1.8.3"
},
"devDependencies": {
"babel-core": "^6.22.1",
"babel-eslint": "^7.1.1",
"babel-jest": "^18.0.0",
"babel-loader": "^6.2.1",
"babel-plugin-transform-class-properties": "^6.23.0",
"babel-polyfill": "^6.23.0",
"babel-preset-es2015": "^6.22.0",
"babel-preset-react": "^6.3.13",
"css-loader": "^0.26.1",
"enzyme": "^2.7.1",
"eslint": "^3.15.0",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-react": "^6.9.0",
"eslint-watch": "^2.1.14",
"http-server": "^0.9.0",
"image-webpack-loader": "^3.2.0",
"jest-cli": "^18.1.0",
"npm-run-all": "3.1.2",
"open": "0.0.5",
"react-addons-test-utils": "^15.4.2",
"sinon": "^1.17.7",
"style-loader": "^0.13.1",
"webpack": "^2.2.1",
"webpack-dev-server": "^2.3.0"
}
}

How to define scripts for npm command?

I am using npm+webpack to manage a react web application. And I want to define a few command for npm in order to run some webpack command. Below is the two command scripts I defined in package.json file.
"scripts": {
"start": "webpack-dev-server --host 0.0.0.0",
"build": "NODE_ENV=production webpack --config ./webpack.config.js --progress --profile --colors"
},
As you can see, there are two commands 'start' and 'build'. When I run npm start it will run webpack-dev-server --host 0.0.0.0 to launch a web server.
But when I run npm build, it doesn't run the configured command and simply returns without any output. I wander how to define a script command for npm to use. Below is my whole package.json file:
{
"name": "demo",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "webpack-dev-server --host 0.0.0.0",
"build": "NODE_ENV=production webpack --config ./webpack.config.js --progress --profile --colors"
},
"author": "",
"license": "ISC",
"devDependencies": {
"babel-core": "^6.9.0",
"babel-loader": "^6.2.4",
"compression-webpack-plugin": "^0.3.1",
"css-loader": "^0.23.1",
"less": "^2.7.1",
"less-loader": "^2.2.3",
"npm-install-webpack-plugin": "^3.1.3",
"style-loader": "^0.13.1",
"svg-sprite-loader": "0.0.26",
"webpack": "^1.13.1",
"webpack-dev-server": "^1.14.1",
"webpack-shell-plugin": "^0.4.2"
},
"dependencies": {
"actions": "^1.3.0",
"axios": "^0.12.0",
"babel-preset-stage-2": "^6.11.0",
"cdnjs": "^0.3.2",
"components": "^0.1.0",
"containers": "0.0.1",
"extract-text-webpack-plugin": "^1.0.1",
"features": "^0.1.0",
"file-loader": "^0.8.5",
"fo": "^0.1.1",
"jshint": "^2.9.2",
"jshint-loader": "^0.8.3",
"leaflet": "^0.7.7",
"material-ui": "^0.15.2",
"moment": "^2.13.0",
"normalize.css": "^3.0.2",
"nuka-carousel": "^2.0.0",
"public": "^0.1.2",
"query-string": "^4.2.2",
"react": "^15.1.0",
"react-addons-css-transition-group": "^15.1.0",
"react-addons-shallow-compare": "^15.1.0",
"react-alert": "^1.0.14",
"react-button": "^1.2.1",
"react-cookie": "^0.4.7",
"react-date-picker": "^5.3.9",
"react-datepicker": "^0.27.0",
"react-dom": "^15.0.2",
"react-infinite-calendar": "^1.1.14",
"react-redux": "^4.4.5",
"react-router": "^2.4.1",
"react-router-redux": "^4.0.5",
"react-select": "^1.0.0-beta13",
"react-spinkit": "^1.1.8",
"react-tap-event-plugin": "^1.0.0",
"react-tappable": "^0.8.1",
"redux": "^3.5.2",
"redux-thunk": "^2.1.0",
"sha1": "^1.1.1",
"source-map-loader": "^0.1.5",
"src": "^1.1.2",
"style": "0.0.3",
"url-loader": "^0.5.7",
"utils": "^0.3.1"
}
}
You can use npm run-script <script-name> to run arbitrary scripts. In your case, npm run-script build.
From the npm documentation, The npm <script-name> syntax is only supported for a specific number of predetermined scripts such as start.
npm supports the "scripts" property of the package.json script, for
the following scripts:
prepublish: Run BEFORE the package is published. (Also run on local npm install without any arguments.)
publish, postpublish: Run AFTER the package is published.
preinstall: Run BEFORE the package is installed
install, postinstall: Run AFTER the package is installed.
preuninstall, uninstall: Run BEFORE the package is uninstalled.
postuninstall: Run AFTER the package is uninstalled.
preversion, version: Run BEFORE bump the package version.
postversion: Run AFTER bump the package version.
pretest, test, posttest: Run by the npm test command.
prestop, stop, poststop: Run by the npm stop command.
prestart, start, poststart: Run by the npm start command.
prerestart, restart, postrestart: Run by the npm restart command. Note: npm restart will run the stop and start scripts if no restart script is provided.
Additionally, arbitrary scripts can be executed by running npm run-script <pkg> <stage>. Pre and post commands with matching names
will be run for those as well (e.g. premyscript, myscript,
postmyscript).
As well, you can use npm run <script-name> as a shorthand.
You can define an npm script just like how you have it here:
"scripts": {
"start": "webpack-dev-server --host 0.0.0.0",
"build": "NODE_ENV=production webpack --config ./webpack.config.js --progress --profile --colors"
},
To run the build command enter:
$ npm run build
you need to use command npm run build

Resources