我有一个非常简单的Node.js/tyescript项目,我总是能够使用npm run build构建该项目,然后使用以下命令将其部署到Google App Engine Standard for Node.js上: cloud app deploy --version=x

从今天开始,它会给出以下错误:

Do you want to continue (Y/n)?  y

Beginning deployment of service [default]...
╔════════════════════════════════════════════════════════════╗
╠═ Uploading 0 files to Google Cloud Storage                ═╣
╚════════════════════════════════════════════════════════════╝
File upload done.
Updating service [default]...failed.                                                                                                                                                                                                                                                                                    
ERROR: (gcloud.app.deploy) Error Response: [9] Cloud build 2e4915bf-4af5-4ede-80c8-196d55653451 status: FAILURE
> frontend@0.1.0 build
> webpack

assets by status 0 bytes [cached] 1 asset

WARNING in configuration
The 'mode' option has not been set, webpack will fallback to 'production' for this value.
Set 'mode' option to 'development' or 'production' to enable defaults for each environment.
You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/configuration/mode/

ERROR in main
Module not found: Error: Can't resolve './src' in '/workspace'
resolve './src' in '/workspace'
using description file: /workspace/package.json (relative path: .)
Field 'browser' doesn't contain a valid alias configuration
using description file: /workspace/package.json (relative path: ./src)
  no extension
    Field 'browser' doesn't contain a valid alias configuration
    /workspace/src is not a file
  .js
    Field 'browser' doesn't contain a valid alias configuration
    /workspace/src.js doesn't exist
  .json
    Field 'browser' doesn't contain a valid alias configuration
    /workspace/src.json doesn't exist
  .wasm
    Field 'browser' doesn't contain a valid alias configuration
    /workspace/src.wasm doesn't exist
  as directory
    existing directory /workspace/src
      using description file: /workspace/package.json (relative path: ./src)
        using path: /workspace/src/index
          using description file: /workspace/package.json (relative path: ./src/index)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              /workspace/src/index doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              /workspace/src/index.js doesn't exist
            .json
              Field 'browser' doesn't contain a valid alias configuration
              /workspace/src/index.json doesn't exist
            .wasm
              Field 'browser' doesn't contain a valid alias configuration
              /workspace/src/index.wasm doesn't exist

webpack 5.75.0 compiled with 1 error and 1 warning in 197 ms
Full build logs: https://console.cloud.google.com/cloud-build/builds;region=us-central1/2e4915bf-4af5-4ede-80c8-196d55653451?project=232127403419

我不确定它为什么要try 运行构建.我总是在本地执行NPM运行构建,然后运行gCloud命令进行部署.进行构建所需的一些文件都在.gclouguatore中,因为我只想上传编译后的Java脚本,而不是我的打字脚本/webpack的东西.我以前从来没有看过云构建,但现在我看到以前成功的构建甚至从来没有try 过在我的项目上构建,而新的try 做到了.

我是一名业余爱好开发人员,没有谷歌云的支持合同,我希望其他人也遇到同样的问题,可以帮助我解决问题.

Google Cloud SDK 413.0.0
alpha 2023.01.06
beta 2023.01.06
bq 2.0.84
bundled-python3-unix 3.9.12
cloud-datastore-emulator 2.3.0
core 2023.01.06
gcloud-crc32c 1.0.0
gsutil 5.17


To take a quick anonymous survey, run:
$ gcloud survey

Node.js版本:

leejjon@mymachine:~/projects/Blindpool$ node --version
v18.14.1

我的代码可以在以下位置找到: https://github.com/Leejjon/Blindpool/tree/master/blindpool-frontend

推荐答案

2023年4月11日发布的NodeJS应用程序中引入了breaking change

对于使用Node.js运行时的所有服务,如果在您的Package.json文件中定义了NPM构建脚本,则在部署期间为npm run build now automatically runs.

如果您不希望它运行构建,则在package.json文件的scripts部分/部分中添加"gcp-build":""

Node.js相关问答推荐

链接Inbox类方法,范围在哪里以及为什么发生变化?

如何在不丢失其他键的情况下解开子文档数组,然后反转该过程?

如何在Sequelize with Postgres中将m:n关联表ID从整数迁移到UUID?

Webpack:如何避免导出函数的重命名?

为什么它无法发送发布请求并更改为 chrome 中的获取方法?

如何使用 $PATH 变量在系统中全局自动安装 bash 脚本?或者重写脚本到node

Electron 模板(Typescript + Webpack)中的这个 Electron Forge ERROR 是什么?

Nodejs mongoose 在一个查询中从多个集合中获取结果

访问 Mongoose 查询之外的变量

用户通过 oauth2 twitter 授权或通过Passport discord后如何重定向到 React/Vue 路由?

使用 firebase 函数 api 运行套接字(相同的端口创建问题)

tsc:当我上传 React+next js 和 node 项目时,在 heroku 找不到

Firestore promise 在退货前等待产品详细信息

node.js 中 pdfkit-tables 中的垂直线

为什么 Node 控制台不显示功能代码?

使用 pm2 编程 api 重命名进程

Javascript在try块内设置const变量

Express js 阻止 GET /favicon.ico

Socket.IO 连接用户数

yarn 和 npm 的主要区别是什么?