无法使用“ npm脚本”部署Firebase?

时间:2020-02-15 01:58:28

标签: angular firebase npm firebase-hosting

我可以通过在命令行上执行firebase deploy --only hosting来轻松部署我的Firebase应用程序(角度应用程序)。我想改为通过npm run deploy-hosting运行它。但是它不起作用,只是出错了。这是我的package.json:

{
    "scripts": {
        "deploy-hosting": "firebase deploy --only hosting"
    }
}

以下是输出:

$ npm run deploy-hosting

> site@ deploy-hosting /Users/me/workspace/site
> firebase deploy --only hosting


Error: An unexpected error has occurred.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! site@ deploy-hosting: `firebase deploy --only hosting`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the site@ deploy-hosting 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!     /Users/me/.npm/_logs/2020-02-15T01_55_56_874Z-debug.log

然后是上面的调试文件:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'run',
1 verbose cli   'deploy-hosting' ]
2 info using npm@6.13.4
3 info using node@v8.17.0
4 verbose run-script [ 'predeploy-hosting', 'deploy-hosting', 'postdeploy-hosting' ]
5 info lifecycle cryptoCoinSignals@~predeploy-hosting: cryptoCoinSignals@
6 info lifecycle cryptoCoinSignals@~deploy-hosting: cryptoCoinSignals@
7 verbose lifecycle cryptoCoinSignals@~deploy-hosting: unsafe-perm in lifecycle true
8 verbose lifecycle cryptoCoinSignals@~deploy-hosting: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/me/workspace/cryptocoinsignals/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Users/me/workspace/cryptocoinsignals/node_modules/.bin
9 verbose lifecycle cryptoCoinSignals@~deploy-hosting: CWD: /Users/me/workspace/cryptocoinsignals
10 silly lifecycle cryptoCoinSignals@~deploy-hosting: Args: [ '-c', 'firebase deploy --only hosting' ]
11 silly lifecycle cryptoCoinSignals@~deploy-hosting: Returned: code: 2  signal: null
12 info lifecycle cryptoCoinSignals@~deploy-hosting: Failed to exec deploy-hosting script
13 verbose stack Error: cryptoCoinSignals@ deploy-hosting: `firebase deploy --only hosting`
13 verbose stack Exit status 2
13 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack     at emitTwo (events.js:126:13)
13 verbose stack     at EventEmitter.emit (events.js:214:7)
13 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at emitTwo (events.js:126:13)
13 verbose stack     at ChildProcess.emit (events.js:214:7)
13 verbose stack     at maybeClose (internal/child_process.js:915:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid cryptoCoinSignals@
15 verbose cwd /Users/me/workspace/cryptocoinsignals
16 verbose Darwin 19.2.0
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "deploy-hosting"
18 verbose node v8.17.0
19 verbose npm  v6.13.4
20 error code ELIFECYCLE
21 error errno 2
22 error cryptoCoinSignals@ deploy-hosting: `firebase deploy --only hosting`
22 error Exit status 2
23 error Failed at the cryptoCoinSignals@ deploy-hosting script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 2, true ]

1 个答案:

答案 0 :(得分:0)

尝试标准重建节点模块。

npm cache --clean force

rm -rf node_modules

rm package.json

npm install

这就是我个人要做的。

很好奇,您是否发现了ELIFECYCLE错误?