Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: copy .npmrc into docker container #449

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

zhullyb
Copy link
Contributor

@zhullyb zhullyb commented Nov 16, 2023

We need set shamefully-hoist to true ( which .npmrc helps us done ), or node won't find dependencies

log below:
node:internal/modules/esm/resolve:844
throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base), null);
^

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'send' imported from /tmp/t/dist/server/entry.mjs
at packageResolve (node:internal/modules/esm/resolve:844:9)
at moduleResolve (node:internal/modules/esm/resolve:901:20)
at defaultResolve (node:internal/modules/esm/resolve:1121:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:396:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:365:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:240:38)
at ModuleWrap. (node:internal/modules/esm/module_job:85:39)
at link (node:internal/modules/esm/module_job:84:36) {
code: 'ERR_MODULE_NOT_FOUND'
}

We need set shamefully-hoist to true, or node won't find dependencies

log below:
node:internal/modules/esm/resolve:844
  throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base), null);
        ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'send' imported from /tmp/t/dist/server/entry.mjs
    at packageResolve (node:internal/modules/esm/resolve:844:9)
    at moduleResolve (node:internal/modules/esm/resolve:901:20)
    at defaultResolve (node:internal/modules/esm/resolve:1121:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:396:12)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:365:25)
    at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:240:38)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:85:39)
    at link (node:internal/modules/esm/module_job:84:36) {
  code: 'ERR_MODULE_NOT_FOUND'
}
Copy link

vercel bot commented Nov 16, 2023

@zhullyb is attempting to deploy a commit to the ddiu8081's Team Team on Vercel.

A member of the Team first needs to authorize it.

@zhullyb
Copy link
Contributor Author

zhullyb commented Nov 16, 2023

#448 中,我通过先将仓库中所有文件都复制到 builder 中,碰巧将 .npmrc 复制到 builder 中,解决了 pnpm install 后依赖不是平铺在 node_modules 文件夹下导致构建失败的问题,但运行时就出现了 node 找不到依赖的问题。所以应当在正式部署的容器中也引入 .npmrc 的 shamefully-hoist 属性,这样就可以解决 node 找不到依赖的问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant