Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error while trying to run npm run build

I have created a simple app with Spring Boot and Angular 4. I tried to run a script which will pack every (npm run build) file from frontend file to the src/main/resources/static file. But I am getting an error which is:

npm ERR! Windows_NT 10.0.15063
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
npm ERR! node v6.9.4
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] postbuild: `npm run deploy`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postbuild script 'npm run deploy'.
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 tasks package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     npm run deploy
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs tasks
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls tasks
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\Michał\IdeaProjects\spring-angular2-tasks-master\Spring with Angular 4\src\main\frontend\npm-debug.log

My package.json file looks:

{
  "name": "tasks",
  "version": "0.0.0",
  "license": "MIT",
  "angular-cli": {},
  "scripts": {
    "ng": "ng",
    "start": "ng serve --proxy-config proxy-conf.json",
    "build": "ng build -prod",
    "postbuild": "npm run deploy",
    "predeploy": "rimraf ../resources/static/ && mkdirp ../resources/static",
    "deploy": "copyfiles -f dist/** ../resources/static",
    "test": "ng test",
    "pree2e": "webdriver-manager update --standalone false --gecko false",
    "e2e": "protractor"
  },
  "private": true,
  "dependencies": {
    "@angular/common": "^4.1.3",
    "@angular/compiler": "^4.1.3",
    "@angular/core": "^4.1.3",
    "@angular/forms": "^4.1.3",
    "@angular/http": "^4.1.3",
    "@angular/platform-browser": "^4.1.3",
    "@angular/platform-browser-dynamic": "^4.1.3",
    "@angular/router": "^4.1.3",
    "bootstrap": "^3.3.7",
    "copyfiles": "^1.2.0",
    "core-js": "^2.4.1",
    "mkdirp": "^0.5.1",
    "moment": "^2.18.1",
    "rimraf": "^2.6.1",
    "rxjs": "^5.0.1",
    "ts-helpers": "^1.1.1",
    "zone.js": "^0.8.11"
  },
  "devDependencies": {
    "@angular/cli": "^1.0.0",
    "@angular/compiler-cli": "^4.1.3",
    "@types/jasmine": "2.5.47",
    "@types/node": "^7.0.22",
    "codelyzer": "~3.0.1",
    "jasmine-core": "2.6.2",
    "jasmine-spec-reporter": "4.1.0",
    "karma": "1.7.0",
    "karma-chrome-launcher": "^2.0.0",
    "karma-cli": "^1.0.1",
    "karma-jasmine": "^1.0.2",
    "karma-remap-istanbul": "^0.6.0",
    "protractor": "~5.1.2",
    "ts-node": "3.0.4",
    "tslint": "^5.3.2",
    "typescript": "~2.3.3"
  },
  "description": "This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 1.2.6.",
  "main": "karma.conf.js",
  "author": ""
}

What am I doing wrong?

UPDATE: After running npm run deploy I have:

> [email protected] predeploy C:\Users\Michał\IdeaProjects\spring-angular2-tasks-master\Spring with Angular 4\src\main\frontend
> rimraf ../resources/static/ && mkdirp ../resources/static


> [email protected] deploy C:\Users\Michał\IdeaProjects\spring-angular2-tasks-master\Spring with Angular 4\src\main\frontend
> copyfiles -f dist/** ../resources/static

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

npm ERR! Windows_NT 10.0.15063
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "deploy"
npm ERR! node v6.9.4
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] deploy: `copyfiles -f dist/** ../resources/static`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] deploy script 'copyfiles -f dist/** ../resources/static'.
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 tasks package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     copyfiles -f dist/** ../resources/static
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs tasks
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls tasks
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\Michał\IdeaProjects\spring-angular2-tasks-master\Spring with Angular 4\src\main\frontend\npm-debug.log
like image 955
bielas Avatar asked Oct 27 '25 03:10

bielas


1 Answers

Solve it by npm install copyfiles -g

like image 179
bielas Avatar answered Oct 28 '25 18:10

bielas



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!