cypress-io / instrument-cra

Little module for CRA applications to instrument code without ejecting react-scripts

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Not working with pnpm

Vader699 opened this issue · comments

I have an app that was using this with npm. I switched to pnpm to install packages and now get this error for the same script.

> training-react@0.2.0 start E:\app
> react-scripts -r @cypress/instrument-cra start

E:\app\node_modules\.pnpm\@cypress+instrument-cra@1.4.0\node_modules\@cypress\instrument-cra\index.js:72
require.cache[webpackConfigPath].exports = fakeConfig
                                         ^

TypeError: Cannot set property 'exports' of undefined
    at Object.<anonymous> (E:\app\node_modules\.pnpm\@cypress+instrument-cra@1.4.0\node_modules\@cypress\instrument-cra\index.js:72:42)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at Module._preloadModules (internal/modules/cjs/loader.js:1244:12)
    at loadPreloadModules (internal/bootstrap/pre_execution.js:475:5)
    at prepareMainThreadExecution (internal/bootstrap/pre_execution.js:72:3)
    at internal/main/run_main_module.js:7:1
 ELIFECYCLE  Command failed with exit code 1.

I'm getting the same error using "rush" tool.
Any updates on that?

Same issue with yarn and executing inside the cypress node docker

I'm having the same issue with pnpm (trying to switch from npm to pnpm).

I am having the same issue. Any workarounds?

If you are running inside the docker container, check out the node_modules path. My case was webpackConfigPath is different than where the actual node_modules folder is located.

check the require.cache object here

require.cache[webpackConfigPath].exports = fakeConfig
to see if there are the /node_modules/react-scripts/config/webpack.config.js property exist