【问题标题】:NPM run package gives error for Angular ElementNPM 运行包为 Angular Element 提供错误
【发布时间】:2020-01-19 00:13:14
【问题描述】:

我正在我的应用程序中创建一个 Angular Element 'ele-counter'。我已经单独测试了组件,它工作正常。它构建成功。但是当我尝试运行包来创建“ele-counter.js”文件时,它会给出以下错误“无法执行包脚本” - 错误代码 ELIFECYCLE。我正在使用 JScat 来运行包。下面是我的代码

package.json

"build-element": "ng build ele-counter && ng build --prod --output-hashing none",
"package": "jscat ./dist/custom-counter/runtime.js ./dist/custom-counter/polyfills.js ./dist/custom-counter/scripts.js ./dist/custom-counter/main.js > ele-counter.js"

当我尝试运行以下命令时

npm run build-element && npm run package

第一个命令运行良好。但它失败了 - npm run package

以下来自日志文件

info lifecycle custom-counter@0.0.0~package: Failed to exec package script
verbose stack Error: custom-counter@0.0.0 package: `jscat ./dist/custom-counter/runtime.js ./dist/custom-counter/polyfills.js ./dist/custom-counter/scripts.js ./dist/custom-counter/main.js > ele-counter.js`
verbose stack Exit status 1

error code ELIFECYCLE
error errno 1

This is probably not a problem with npm. There is likely additional logging output above.

我已经尝试过缓存清理、更新 node_modules 等。无论我在谷歌上找到哪种解决方案。但没有任何效果。

谁能帮忙?

【问题讨论】:

    标签: angular npm npm-scripts angular-elements


    【解决方案1】:

    使用“npm run”而不是“npm run package”

    “npm run-script build”然后“npm run”

    【讨论】:

    • npm run-script build
    猜你喜欢
    • 2022-11-11
    • 1970-01-01
    • 2019-08-08
    • 2017-08-01
    • 2018-07-21
    • 2022-01-07
    • 2021-03-22
    • 2016-08-12
    • 2017-07-03
    相关资源
    最近更新 更多