Plugin could not be found using local path when netlify dev is run with cypress plugin


I’m having an issue with a local build plugin in a pnpm workspace project with different folders for different sites. The local build plugin does a very simple job. During preBuild it pulls some serialization files, pushes new ones and onError reverts them. This part works fine.

I also have cypress-plugin which runs netlify dev during preBuild and perform some tests. If all is ok build starts and continues.

My project folder hierarchy is as follows

  • Root
    • lib
    • sites
      • mysite
        • cypress
        • plugins
          • uniform-build-events
            • index.js
            • manifest.yml
        • netlify.toml
        • package.json

I have following context definition in Netlify.toml

command="pnpm build"
    package = "/plugins/uniform-build-events"
    package = "netlify-plugin-cypress"
        enable = false      
        enable = true  
        spec = "cypress/e2e/*.feature"
        start= "netlify dev"
        wait-on= "http://localhost:8888"

The problem is, when β€œnetlify dev” is run during cypress plugin it fails with β€œPlugin could not be found using local path” error

In logs I see

4:32:14 PM: Next.js cache restored.
4:32:14 PM: Netlify configuration property "build.environment.NEXT_PRIVATE_TARGET" value changed.
4:32:14 PM: ​
4:32:14 PM: (@netlify/plugin-nextjs onPreBuild completed in 415ms)
4:32:14 PM: ​
4:32:14 PM: ./plugins/uniform-build-events (onPreBuild event)             
4:32:14 PM: 
4:32:26 PM: (./plugins/uniform-build-events onPreBuild completed in 10.2s)
4:32:26 PM: 
4:32:26 PM: netlify-plugin-cypress (onPreBuild event)                     
4:32:26 PM: ​
4:32:34 PM: [STARTED] Task without title.
4:32:36 PM: [SUCCESS] Task without title.
4:32:36 PM: DevTools listening on ws://
4:32:37 PM: waiting on "http://localhost:8888" with timeout of 120 seconds
4:33:16 PM: β—ˆ Netlify Dev β—ˆ
4:33:16 PM: β—ˆ Ignored netlify.toml file env var: CYPRESS_CACHE_FOLDER (defined in process)
4:33:16 PM: β—ˆ Ignored netlify.toml file env var: TERM (defined in process)
4:33:16 PM: Configuration error                                           
4:33:16 PM: ────────────────────────────────────────────────────────────────
4:33:16 PM: ​
4:33:16 PM:   Error message
4:33:16 PM:   Plugin could not be found using local path: ./plugins/uniform-build-events
4:33:16 PM:   Cannot find module "./plugins/uniform-build-events"
4:33:16 PM:   Require stack:
4:33:16 PM:   - /opt/build/repo/node_modules/.pnpm/@netlify+build@29.33.5_@types+node@20.6.3/node_modules/@netlify/build/lib/utils/resolve.js

I’ve tried defining package as
package = β€œ/plugins/uniform-build-events” or
package = β€œ./plugins/uniform-build-events”

onPreBuild it runs properly but netlify dev complains.

I have 2 questions.

Is there a parameter to disable plugins when running netlify dev command?
Why netlify dev command can’t find the plugin but build finds?

If it helps, here is a deploy id that fails. 65c3a23ff0a8d40008580918


1 Like

I don’t think it’s possible to check this without seeing the repo that reproduces this issue. Let me know if you can share it or a minimal reproduction of it.