尝试运行npm run build时出错

时间:2017-07-30 09:14:00

标签: spring angular spring-boot package

我创建了一个包含Spring BootAngular 4的简单应用。我尝试运行一个脚本,它将每个(npm run build)文件从前端文件打包到src/main/resources/static文件。但我收到的错误是:

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! tasks@0.0.0 postbuild: `npm run deploy`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the tasks@0.0.0 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

我的package.json文件显示:

{
  "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": ""
}

我做错了什么?

更新: 运行npm run deploy之后我有:

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


> tasks@0.0.0 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! tasks@0.0.0 deploy: `copyfiles -f dist/** ../resources/static`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the tasks@0.0.0 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

1 个答案:

答案 0 :(得分:0)

npm install copyfiles -g

解决