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

Cannot find module '_process' from generated next_blog.js #95

Closed
painedpineapple opened this issue Feb 5, 2021 · 1 comment
Closed

Comments

@painedpineapple
Copy link

painedpineapple commented Feb 5, 2021

I have spent a great deal of time trying to figure out why I'm getting the error below. It's clear that the '_process' module that's missing is being required by a generated function to get the next blog post of my netlify/next app (using this plugin of course). I could be mistaken but I believe it's this plugin (or something higher up in the netlify build?) that's generating these files (screenshot below). I've scoured docs and have tried to mess around with directory structures, configurations, etc. but cannot figure out why this module is being required by these generated files w/out it being accessible. Of course, I tried to install _process via yarn but no dice there either. Any suggestions here would be greatly appreciated. Thanks for all the awesome work you all do!

  Dependencies installation error                               
────────────────────────────────────────────────────────────────

  Error message
  A Netlify Function failed to require one of its dependencies.
  If the dependency is a Node module, please make sure it is present in the site's top-level "package.json".
  If it is a local file instead, please make sure the file exists and its filename is correctly spelled.

  In file "/home/thislogancall/code/next-netlify-project/.netlify/functions/next_blog/next_blog.js"
  Cannot find module '_process'
  Require stack:
  - /home/thislogancall/code/next-netlify-project/node_modules/@netlify/zip-it-and-ship-it/src/node_dependencies/resolve.js
  - /home/thislogancall/code/next-netlify-project/node_modules/@netlify/zip-it-and-ship-it/src/node_dependencies/index.js
  - /home/thislogancall/code/next-netlify-project/node_modules/@netlify/zip-it-and-ship-it/src/main.js
  - /home/thislogancall/code/next-netlify-project/node_modules/@netlify/build/src/plugins_core/functions/index.js
  - /home/thislogancall/code/next-netlify-project/node_modules/@netlify/build/src/commands/get.js
  - /home/thislogancall/code/next-netlify-project/node_modules/@netlify/build/src/core/main.js
  - /home/thislogancall/code/next-netlify-project/node_modules/netlify-cli/src/lib/build.js
  - /home/thislogancall/code/next-netlify-project/node_modules/netlify-cli/src/commands/build/index.js
  - /home/thislogancall/code/next-netlify-project/node_modules/@oclif/config/lib/plugin.js
  - /home/thislogancall/code/next-netlify-project/node_modules/@oclif/config/lib/config.js
  - /home/thislogancall/code/next-netlify-project/node_modules/@oclif/config/lib/index.js
  - /home/thislogancall/code/next-netlify-project/node_modules/@oclif/command/lib/command.js
  - /home/thislogancall/code/next-netlify-project/node_modules/@oclif/command/lib/index.js
  - /home/thislogancall/code/next-netlify-project/node_modules/netlify-cli/src/index.js
  - /home/thislogancall/code/next-netlify-project/node_modules/netlify-cli/bin/run

  Resolved config
  build:
    command: yarn run create
    commandOrigin: config
    functions: /home/thislogancall/code/next-netlify-project/.netlify/functions
    publish: /home/thislogancall/code/next-netlify-project/dist
  plugins:
    - inputs: {}
      origin: config
      package: '@netlify/plugin-nextjs'
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Directory structure:

image

Dependency version:

    "netlify-lambda": "^2.0.3",
    "next": "^9.5.3",
    "next-transpile-modules": "^4.1.0",
    "react": "^17.0.1",
    "react-dom": "^17.0.1",
    "@netlify/plugin-nextjs": "^2.0.0",
    "netlify-cli": "^3.4.7",

Babel config:

{
  "presets": [
    "@babel/preset-env",
    "next/babel"
  ],
  "retainLines": true,
  "env": {
    "production": {
      "plugins": [
        [
          "@babel/plugin-transform-regenerator",
          {
            "asyncGenerators": true,
            "generators": true,
            "async": true
          }
        ],
        [
          "@emotion/babel-plugin",
          {
            "hoist": true
          }
        ]
      ]
    },
    "development": {
      "plugins": [
        [
          "@babel/plugin-transform-regenerator",
          {
            "asyncGenerators": true,
            "generators": true,
            "async": true
          }
        ],
        [
          "@emotion/babel-plugin",
          {
            "sourceMap": true
          }
        ]
      ]
    }
  }
}
@painedpineapple
Copy link
Author

https://community.netlify.com/t/cannot-find-module-process-from-generated-next-blog-js/31928/3

serhalp pushed a commit that referenced this issue Apr 5, 2024
* fix: next.js doesn't respect swr standard

* chore: add test for swr fix

* chore: update tests with new swr value
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

No branches or pull requests

1 participant