docker-compose build 找不到模块'./src'

时间:2021-02-03 19:33:33

标签: docker npm

我最近跑了 npm installnpm 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

我试过了...

  1. 重复npm installnpm update
  2. 运行docker-compose up --build
  3. 运行 npm install --save-dev dotenv-webpack,因为这似乎与 webpack 相关

结果是一样的。

我的技术理解水平有限,但我正在努力快速提高。

感谢任何帮助。谢谢!

0 个答案:

没有答案
相关问题