NPM运行构建在云功能中失败-Firebase

时间:2019-12-25 07:37:52

标签: node.js npm

npm run build输出

npm ERR! missing script: build

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/apple/.npm/_logs/2019-12-25T07_29_54_509Z-debug.log

这是日志文件:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'build' ]
2 info using npm@6.13.4
3 info using node@v10.16.0
4 verbose stack Error: missing script: build
4 verbose stack     at run (/usr/local/lib/node_modules/npm/lib/run-script.js:155:19)
4 verbose stack     at /usr/local/lib/node_modules/npm/lib/run-script.js:63:5
4 verbose stack     at /usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:116:5
4 verbose stack     at /usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:436:5
4 verbose stack     at checkBinReferences_ (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:391:45)
4 verbose stack     at final (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:434:3)
4 verbose stack     at then (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:161:5)
4 verbose stack     at ReadFileContext.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:350:20)
4 verbose stack     at ReadFileContext.callback (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:115:16)
4 verbose stack     at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:237:13)
5 verbose cwd /Users/apple/Desktop/dev/func/functions
6 verbose Darwin 17.5.0
7 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "build"
8 verbose node v10.16.0
9 verbose npm  v6.13.4
10 error missing script: build
11 verbose exit [ 1, true ]

此外,当我在索引中进行更改时。tsfirebase deploy不会使用最新更改来更新函数。

2 个答案:

答案 0 :(得分:0)

您可能缺少构建脚本。 确保package.json文件中的脚本下有一个脚本。 如果不这样做,只需添加:

"scripts": {
    "build": "do-whatever-needs-to-be-done"
}

答案 1 :(得分:-1)

您应在项目的路径中执行此命令