Error when running plugin: cannot read property isBuffer of undefined
NullVoxPopuli opened this issue · comments
trace from browser:
Error running plugin
The following error was thrown by a plugin. We've stopped running your tests because a plugin crashed.
TypeError: Cannot read property 'isBuffer' of undefined
at Object. (/home/me/Development/NullVoxPopuli/react-vs-ember/testing/react/node_modules/core-util-is/lib/util.js:103:26)
at Object. (/home/me/Development/NullVoxPopuli/react-vs-ember/testing/react/node_modules/core-util-is/lib/util.js:109:3)
at Module._compile (/home/me/me/NullVoxPopuli/react-vs-ember/testing/react/node_modules/v8-compile-cache/v8-compile-cache.js:178:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Module.require (module.js:513:17)
at require (/home/me/Development/NullVoxPopuli/react-vs-ember/testing/react/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
at Object. (/home/me/Development/NullVoxPopuli/react-vs-ember/testing/react/node_modules/readable-stream/lib/_stream_readable.js:67:12)
at Object. (/home/me/Development/NullVoxPopuli/react-vs-ember/testing/react/node_modules/readable-stream/lib/_stream_readable.js:1020:3)
at Module._compile (/home/me/Development/NullVoxPopuli/react-vs-ember/testing/react/node_modules/v8-compile-cache/v8-compile-cache.js:178:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
info:
"cypress": "^3.0.1",
"cypress-parcel-preprocessor": "github:cypress-io/cypress-parcel-preprocessor#fa7f05b1e05c106693cd57cb5274edad5985d547",
"parcel-bundler": "^1.7.1",
$ yarn --version
1.6.0
$ npm --version
5.6.0
$ node --version
v8.11.1
$ uname -a
Linux Calypso 4.15.0-22-generic #24-Ubuntu SMP Wed May 16 12:15:17 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04 LTS
Release: 18.04
Codename: bionic
all I did after installing was change my plugins file to look like this:
const cyParcel = require('cypress-parcel-preprocessor');
module.exports = (on, config) => {
on('file:preprocessor', cyParcel)
}
the error happens after clicking "run all tests".
here is a reproduction: https://github.com/NullVoxPopuli/react-vs-ember/tree/db314cb2186a875f25fe459c88954fe3158c6088
yes, I have seen this error in some versions of Parcel that use global Buffer
to keep hashes of filenames, and this Buffer
somehow is undefined during bundling, even if it is actually set initially in Cypress :( I think there is something very funky going on with the way Parcel spawns separate bundling workers. Requires some debugging. What version of Parcel bundler are you running?
My yarn.lock says parcel-bundler is 1.8.1
Why does parcel (or any bundler) need to be involved? Why not just use tsc? Or the prebuilt output of whatever bundler. (This was my technique when trying out puppeteer) ... Would make things much simpler.
I am working on react js project. I am trying to create .exe file but got error when run .exe file.
I followed steps from this link: https://ourcodeworld.com/articles/read/365/how-to-create-a-windows-installer-for-an-application-built-with-electron-framework
Suggest if any solution.
Same here on parcel-bundler@1.10.3
:/
Went all the way back to parcel-bundler@1.7.1
to see if that makes a difference.
Now i'm getting the Cannot resolve dependency './logo.css' at ...
errors instead.
Which is the original problem I was trying to solve using this very plugin :/
Is there any other way to get my CSS loaded from JS?
Worked around it temporarily with the following plugin config under \cypress\plugins\index.js
:
const webpack = require('@cypress/webpack-preprocessor');
module.exports = (on) => {
const options = webpack.defaultOptions;
options.webpackOptions.module.rules.push({
test: /\.css$/,
use: [
'style-loader',
{ loader: 'css-loader', options: { modules: true, importLoaders: 1 } },
'postcss-loader',
],
});
on('file:preprocessor', webpack(options));
};
Also had to install @cypress/webpack-preprocessor
, postcss-loader
, css-loader
, style-loader
, @babel/core
, @babel/preset-env
, babel-loader
and webpack
to make it work.
Several unicorns died along the way...
I had this issue when using .ts
for spec files but .js
for the support file. Changed everything to .ts
now it's fine.
Experiencing the same issue with parcel-bundler@1.11.0. parcel-bundler@1.7.1 does work but npm indicates that version has "high severity vulnerability".
@bahmutov any thoughts on how to go about fixing this issue?
any updates on this issue? can confirm it's working with parcel 1.7.1 but wouldn't mind to use the latest version :D
btw solved by removing this plugin...
A couple of observations in case it's helpful in figuring out a fix:
- Electron deletes some node globals, including
Buffer
--could this be related? - I only get this error if Babel is somehow triggered (i.e., if
.../@babel/generator/lib/generators/...)
shows up in the stack trace. Maybe this helps explain why renaming everything to.ts
worked for @Xiphe (i.e., maybe Parcel did not need to use Babel for a transform)?