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.

Fails after `npm install` (TypeError: Cannot read property 'program' of null)

See original GitHub issue

I run with this issue in one of my projects.

I cloned detrohutt/babel-plugin-inline-import-graphql-ast run npm run test then faced the same issue :

 FAIL  tests/schema.test.js
  ● simple schema document › inlines as raw unparsed text'

    TypeError: Cannot read property 'program' of null

      67 |         function buildVariableAST(graphqlAST, importName) {
      68 |           const { ast } = transformSync(`var ${importName} = ${JSON.stringify(graphqlAST)}`)
    > 69 |           return ast.program.body[0]
      70 |         }
      71 |       }
      72 |     }
      
      at buildVariableAST (plugin/index.js:69:22)
      at PluginPass.exit (plugin/index.js:30:33)
      at newFn (node_modules/@babel/traverse/lib/visitors.js:223:21)
      at NodePath._call (node_modules/@babel/traverse/lib/path/context.js:64:19)
      at NodePath.call (node_modules/@babel/traverse/lib/path/context.js:38:17)
      at NodePath.visit (node_modules/@babel/traverse/lib/path/context.js:108:8)
      at TraversalContext.visitQueue (node_modules/@babel/traverse/lib/context.js:135:18)
      at TraversalContext.visitMultiple (node_modules/@babel/traverse/lib/context.js:89:17)
      at TraversalContext.visit (node_modules/@babel/traverse/lib/context.js:174:19)
      at Function.Object.<anonymous>.traverse.node (node_modules/@babel/traverse/lib/index.js:76:17)
      at NodePath.visit (node_modules/@babel/traverse/lib/path/context.js:106:18)
      at TraversalContext.visitQueue (node_modules/@babel/traverse/lib/context.js:135:18)
      at TraversalContext.visitSingle (node_modules/@babel/traverse/lib/context.js:94:19)
      at TraversalContext.visit (node_modules/@babel/traverse/lib/context.js:176:19)
      at Function.Object.<anonymous>.traverse.node (node_modules/@babel/traverse/lib/index.js:76:17)
      at traverse (node_modules/@babel/traverse/lib/index.js:46:12)
      at transformFile (node_modules/@babel/core/lib/transformation/index.js:108:27)
      at runSync (node_modules/@babel/core/lib/transformation/index.js:35:3)
      at transformFileSync (node_modules/@babel/core/lib/transform-file-sync.js:29:38)
      at transformWithPlugin (tests/util.js:5:10)
      at Object.<anonymous> (tests/schema.test.js:6:22)

node v8.9.3 npm v5.7.1

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
oudmanecommented, Mar 14, 2018

I removed node_modules lock. files and run npm install again and it worked, Thanks a lot 😃

0reactions
detrohuttcommented, Mar 14, 2018

Glad it worked, thanks for reporting this bug!

Read more comments on GitHub >

github_iconTop Results From Across the Web

npm install getting Cannot read property 'name' of null error
Hey, try removing npm from dependencies then 1. delete package-lock.json and node module folder 2. run npm install again. – Sakshi Mahajan. Feb ......
Read more >
[BUG] Cannot read property 'pickAlgorithm' of null #5496
Current Behavior. Whenever typing an npx function, I receive an error. It seems that NPM, itself, is broken on my device.
Read more >
err! cannot read properties of null (reading 'pickalgorithm')
The error "Cannot read property 'pickAlgorithm' of null" usually indicates that there is a problem with the package that you are trying to...
Read more >
How to resolve this npm ERR! Cannot read property ...
I have cloned https://github.com/SAP-samples/cap-sflight into BAS and I am trying to build mta but I am getting this following error.
Read more >
Cannot read properties of null (reading 'pickAlgorithm')
To solve the NPM error "Cannot read properties of null (reading 'pickAlgorithm')", run the npm cache clear --force and rerun your npm install...
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