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: fix find-cache-dir missing dependency #127

Merged
merged 1 commit into from
Mar 11, 2021
Merged

Conversation

ehmicky
Copy link

@ehmicky ehmicky commented Mar 11, 2021

Fixes #126.

We use the find-cache-dir dependency but do not include it in our package.json dependencies.

https://github.com/netlify/netlify-plugin-nextjs/blob/61b61f57d58ae095e3522c86013c75823911179b/src/lib/steps/prepareFolders.js#L3

https://github.com/netlify/netlify-plugin-nextjs/blob/61b61f57d58ae095e3522c86013c75823911179b/src/lib/helpers/handleFileTracking.js#L3

This creates the following bug in production:

Could not import plugin:
Cannot find module 'find-cache-dir'
Require stack:
- /opt/build/repo/.netlify/plugins/node_modules/@netlify/plugin-nextjs/src/lib/steps/prepareFolders.js
- /opt/build/repo/.netlify/plugins/node_modules/@netlify/plugin-nextjs/src/index.js
- /opt/build/repo/.netlify/plugins/node_modules/@netlify/plugin-nextjs/index.js
- /opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/src/plugins/child/logic.js
- /opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/src/plugins/child/load.js
- /opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/src/plugins/child/main.js 
    internal/modules/cjs/loader.js:957:15 Function.Module._resolveFilename
    internal/modules/cjs/loader.js:840:27 Function.Module._load
    internal/modules/cjs/loader.js:1019:19 Module.require
    internal/modules/cjs/helpers.js:77:18 require
    /opt/build/repo/.netlify/plugins/node_modules/@netlify/plugin-nextjs/src/lib/steps/prepareFolders.js:3:22 Object.<anonymous>
    internal/modules/cjs/loader.js:1133:30 Module._compile
    internal/modules/cjs/loader.js:1153:10 Object.Module._extensions..js
    internal/modules/cjs/loader.js:977:32 Module.load
    internal/modules/cjs/loader.js:877:14 Function.Module._load
    internal/modules/cjs/loader.js:1019:19 Module.require

find-cache-dir is a dependency of next, so it turns out the module can still be required most of the times. However, there are cases where this is not the case, e.g. when next is not a site dependency (see #117).

@ehmicky ehmicky added the type: bug code to address defects in shipped code label Mar 11, 2021
@ehmicky ehmicky self-assigned this Mar 11, 2021
@ehmicky ehmicky merged commit c87df06 into main Mar 11, 2021
@ehmicky ehmicky deleted the fix/fix-find-cache-dir branch March 11, 2021 21:09
serhalp pushed a commit that referenced this pull request Apr 5, 2024
* feat: add systemlog shim

* fix: add json.stringify so its all in one line

* feat: adopt structured logger from edge utils
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug code to address defects in shipped code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing dependency find-cache-dir
2 participants