question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: Cannot read property 'isPure' of null

See original GitHub issue

Input Code

Repo : https://github.com/jy95/torrent-files-library/tree/5b771ae69dd9b796b30a1147bedc25cd085af09d Changes not commited : Just added "babel-preset-minify": "^0.3.0" in my package.json and updated my .babelrc.js like this

let env = process.env.BABEL_ENV || process.env.NODE_ENV;
let presets = [];
let plugins = ["@babel/plugin-proposal-object-rest-spread"];
let ignore = ["src/docs/**/*.js"];
let comments = false;

// custom settings for prod/test ; for example babel-istanbul-plugin , etc.
switch (env){
  case 'test':
    // ./fix-coverage/arrow-function-coverage-fix.js : Because some odd issue for istanbul/nyc
    plugins.push.apply(plugins, ["./fix-coverage/arrow-function-coverage-fix.js", "babel-plugin-istanbul"]);
    break;

  case 'production':
    presets.push.apply(presets, ['minify']);
    break;
}

// default preset
presets.push.apply(presets, ["@babel/preset-env"]);

module.exports = {
  presets: presets,
  plugins: plugins,
  ignore: ignore,
  comments: comments,
};

Command to run production build

npm run prepare

Actual Output

TypeError: Cannot read property 'isPure' of null
    at Object.checkPath (D:\workspaceNodeJs\torrent-files-library\node_modules\@babel\traverse\lib\path\lib\virtual-types.js:120:23)
    at NodePath.(anonymous function) [as isPure] (D:\workspaceNodeJs\torrent-files-library\node_modules\@babel\traverse\lib\path\index.js:226:24)
    at isPureAndUndefined (D:\workspaceNodeJs\torrent-files-library\node_modules\babel-plugin-transform-remove-undefined\lib\index.js:21:13)
    at PluginPass.VariableDeclaration (D:\workspaceNodeJs\torrent-files-library\node_modules\babel-plugin-transform-remove-undefined\lib\index.js:216:21)
    at newFn (D:\workspaceNodeJs\torrent-files-library\node_modules\@babel\traverse\lib\visitors.js:223:21)
    at NodePath._call (D:\workspaceNodeJs\torrent-files-library\node_modules\@babel\traverse\lib\path\context.js:64:19)
    at NodePath.call (D:\workspaceNodeJs\torrent-files-library\node_modules\@babel\traverse\lib\path\context.js:38:17)
    at NodePath.visit (D:\workspaceNodeJs\torrent-files-library\node_modules\@babel\traverse\lib\path\context.js:99:12)
    at TraversalContext.visitQueue (D:\workspaceNodeJs\torrent-files-library\node_modules\@babel\traverse\lib\context.js:139:18)
    at TraversalContext.visitMultiple (D:\workspaceNodeJs\torrent-files-library\node_modules\@babel\traverse\lib\context.js:93:17)

Thanks for your help.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:1
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
garymathewscommented, Feb 14, 2018

Here’s a workaround, disable removeUndefined:

['minify', { removeUndefined: false }]
1reaction
ghostcommented, Feb 23, 2018

in my case

['minify', { removeUndefined: false, simplify: false }]
Read more comments on GitHub >

github_iconTop Results From Across the Web

JavaScript - "Cannot read property 'querySelector' of null" Error
I just added $( document ).ready(function() and It happend. $( document ).ready(function() { var btn = document.querySelector( '.btn' ); var ...
Read more >
How to fix " TypeError: Cannot read properties of ... - YouTube
JS Casts 12 - How to fix " TypeError : Cannot read properties of null (reading addEventListener)" in JavaScript.
Read more >
Is your JavaScript function actually pure? - André Staltz
So how can we tell that one function is pure and the other isn't? ... sum(); // TypeError: Cannot read property 'length' of...
Read more >
Cannot read property setZoomJSLib of Undefined - Web
We are going to fix this 'undefined' generated error and generate a better error message on our application instead, but this does not...
Read more >
AMP Scan fails: cannot read properties of null - WordPress.org
Here is my UUID: ampwp-cb19b1cd-e27d-571a-8a65-e9dc5c49b363. The errorcode: TypeError: Cannot read properties of null (reading 'type') at ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found