npm复制文件不起作用,出现ELIFECYCLE错误

时间:2020-07-06 19:30:06

标签: javascript npm npm-install

我已经使用以下命令安装了复制文件:npm install -g copyfiles@2.0.0 我还在package.json文件中添加了脚本。 这是package.json文件

    {
  "name": "confusion",
  "version": "1.0.0",
  "description": "This is a website for Ristorante Con Fusion",
  "main": "index.html",
  "scripts": {
    "start": "npm run watch-shell",
    "test": "echo \"Error: no test specified\" && exit 1",
    "lite": "lite-server",
    "scss": "node-sass -o css/ css/",
    "watch-scss": "onchange \"css/*.scss\" -- npm run scss",
    "watch-shell": "parallelshell \"npm run watch-scss\" \"npm run lite\"",
    "clean": "rimraf dist",
    "copyfonts": "copyfiles -f \"node_modules/@fortawesome/fontawesome-free/webfonts/*\" \"dist/fonts\""
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "less": "^3.11.3",
    "lite-server": "^2.3.0",
    "onchange": "^3.3.0",
    "parallelshell": "^3.0.1",
    "rimraf": "^2.6.2"
  },
  "dependencies": {
    "@fortawesome/fontawesome-free": "^5.13.0",
    "bootstrap": "^4.5.0",
    "bootstrap-social": "^5.1.1",
    "jquery": "^1.12.4",
    "node-sass": "^4.14.1",
    "popper.js": "^1.16.1"
  }
}

这是我得到的终端输出:

$ npm run copyfonts

> confusion@1.0.0 copyfonts C:\Users\verma\Coursera\Bootstrap4\conFusion
> copyfiles -f "./node_modules/@fortawesome/fontawesome-free/webfonts/*" "dist/fonts"

'copyfiles' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! confusion@1.0.0 copyfonts: `copyfiles -f "./node_modules/@fortawesome/fontawesome-free/webfonts/*" "dist/fonts"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the confusion@1.0.0 copyfonts 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\verma\AppData\Roaming\npm-cache\_logs\2020-07-06T19_20_40_248Z-debug.log

和调试文件:

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'copyfonts'
1 verbose cli ]
2 info using npm@6.14.4
3 info using node@v12.17.0
4 verbose run-script [ 'precopyfonts', 'copyfonts', 'postcopyfonts' ]
5 info lifecycle confusion@1.0.0~precopyfonts: confusion@1.0.0
6 info lifecycle confusion@1.0.0~copyfonts: confusion@1.0.0
7 verbose lifecycle confusion@1.0.0~copyfonts: unsafe-perm in lifecycle true
8 verbose lifecycle confusion@1.0.0~copyfonts: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\verma\Coursera\Bootstrap4\conFusion\node_modules\.bin;C:\Users\verma\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\local\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\verma\bin;C:\Users\verma\Downloads\results\poppler-0.68.0\bin;C:\Program Files\Git\cmd;C:\Program Files\nodejs;C:\Windows\System32;C:\Program Files\nodejs\node_modules\npm\bin;C:\MinGW\bin;C:\Users\verma\AppData\Roaming\npm\node_modules\less\bin;C:\Users\verma\AppData\Local\Programs\Microsoft VS Code\bin;C:\Program Files\Git\usr\bin\vendor_perl;C:\Program Files\Git\usr\bin\core_perl
9 verbose lifecycle confusion@1.0.0~copyfonts: CWD: C:\Users\verma\Coursera\Bootstrap4\conFusion
10 silly lifecycle confusion@1.0.0~copyfonts: Args: [
10 silly lifecycle   '/d /s /c',
10 silly lifecycle   'copyfiles -f "./node_modules/@fortawesome/fontawesome-free/webfonts/*" "dist/fonts"'
10 silly lifecycle ]
11 silly lifecycle confusion@1.0.0~copyfonts: Returned: code: 1  signal: null
12 info lifecycle confusion@1.0.0~copyfonts: Failed to exec copyfonts script
13 verbose stack Error: confusion@1.0.0 copyfonts: `copyfiles -f "./node_modules/@fortawesome/fontawesome-free/webfonts/*" "dist/fonts"`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:315:20)
13 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:315:20)
13 verbose stack     at maybeClose (internal/child_process.js:1021:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
14 verbose pkgid confusion@1.0.0
15 verbose cwd C:\Users\verma\Coursera\Bootstrap4\conFusion
16 verbose Windows_NT 10.0.18362
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "copyfonts"
18 verbose node v12.17.0
19 verbose npm  v6.14.4
20 error code ELIFECYCLE
21 error errno 1
22 error confusion@1.0.0 copyfonts: `copyfiles -f "./node_modules/@fortawesome/fontawesome-free/webfonts/*" "dist/fonts"`
22 error Exit status 1
23 error Failed at the confusion@1.0.0 copyfonts script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

我尝试使用以下命令清除缓存:npm cache clean --force。但这仍然给我和以前一样的错误。

1 个答案:

答案 0 :(得分:-1)

我遇到了同样的问题,但我尝试使用 npm install --save-dev copyfiles