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



我使用以下方法安装了复制文件: 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:UsersvermaCourseraBootstrap4conFusion
> 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:UsersvermaAppDataRoamingnpm-cache_logs2020-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 Filesnodejsnode_modulesnpmnode_modulesnpm-lifecyclenode-gyp-bin;C:UsersvermaCourseraBootstrap4conFusionnode_modules.bin;C:Usersvermabin;C:Program FilesGitmingw64bin;C:Program FilesGitusrlocalbin;C:Program FilesGitusrbin;C:Program FilesGitusrbin;C:Program FilesGitmingw64bin;C:Program FilesGitusrbin;C:Usersvermabin;C:UsersvermaDownloadsresultspoppler-0.68.0bin;C:Program FilesGitcmd;C:Program Filesnodejs;C:WindowsSystem32;C:Program Filesnodejsnode_modulesnpmbin;C:MinGWbin;C:UsersvermaAppDataRoamingnpmnode_moduleslessbin;C:UsersvermaAppDataLocalProgramsMicrosoft VS Codebin;C:Program FilesGitusrbinvendor_perl;C:Program FilesGitusrbincore_perl
9 verbose lifecycle confusion@1.0.0~copyfonts: CWD: C:UsersvermaCourseraBootstrap4conFusion
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 Filesnodejsnode_modulesnpmnode_modulesnpm-lifecycleindex.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:315:20)
13 verbose stack     at ChildProcess.<anonymous> (C:Program Filesnodejsnode_modulesnpmnode_modulesnpm-lifecyclelibspawn.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:UsersvermaCourseraBootstrap4conFusion
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 缓存清理 --force。但它仍然给了我和以前一样的错误。

我遇到了同样的问题,但我尝试了这个 npm 安装 --save-dev copyfiles

最新更新