docker - docker-compose build 找不到模块'./src'
问题描述
我最近跑npm install
和npm update
。
然后我尝试构建我的 docker 容器。我不断得到相同的堆栈跟踪:
Step 7/8 : RUN npm run build
---> Running in 9d7f766e2cf7
> docs.rpg.riotgames.io@1.0.0 build /riot/rpg-docs-hub
> next build
(node:18) ExperimentalWarning: The fs.promises API is experimental
Loaded env from /riot/rpg-docs-hub/.env
> Build error occurred
{ Error: Cannot find module './src'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (/riot/rpg-docs-hub/node_modules/dotenv-webpack/index.js:9:14)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (/riot/rpg-docs-hub/next.config.js:4:16)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32) code: 'MODULE_NOT_FOUND' }
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! docs.rpg.riotgames.io@1.0.0 build: `next build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the docs.rpg.riotgames.io@1.0.0 build 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! /root/.npm/_logs/2021-02-03T19_16_10_771Z-debug.log
ERROR: Service 'rpg-docs-hub' failed to build : The command '/bin/sh -c npm run build' returned a non-zero code: 1
我试过了...
- 重复
npm install
和npm update
- 跑步
docker-compose up --build
- running
npm install --save-dev dotenv-webpack
,因为这似乎与 webpack 相关联
结果是一样的。
我的技术理解水平有限,尽管我正在努力快速提高。
任何帮助表示赞赏。谢谢!
解决方案
推荐阅读
- javascript - 进行切换以向具有特定类的所有元素添加/删除类
- python-3.x - 我需要一种最简单的方法来使用 python 脚本更改文件的内容
- java - 在 SAP Cloud SDK 中使用 Java 为 SFSF 生成 VDM:生成的 URI 错误
- junit - Mockito 核心匹配器-GreaterThan
- apache-spark - 我收到此错误“对象 ml 不是包 org.apache.spark 的成员”
- php - 如何安装 mcrypt PHP 模块
- python - 从 html 表单中获取图像的 Python 问题
- python - 需要预先加载模块时在 VS 代码中运行 pytest
- php - 批量插入 Eloquent Collection - Lumen/Laravel
- amazon-web-services - Terraform:导入现有的互联网网关并附加到 vpc