Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot convert undefined or null to object #164

Closed
joshunger opened this issue Jul 18, 2018 · 2 comments
Closed

Cannot convert undefined or null to object #164

joshunger opened this issue Jul 18, 2018 · 2 comments

Comments

@joshunger
Copy link

joshunger commented Jul 18, 2018

Cannot convert undefined or null to object.

  1. Add grunt.loadNpmTasks('grunt-webpack'); to Gruntfile.js
  2. Execute ./node_modules/.bin/grunt webpack
Running "webpack" task
Warning: Cannot convert undefined or null to object Use --force to continue.
TypeError: Cannot convert undefined or null to object
  at Function.keys (<anonymous>:null:null)
  at Object.webpackTask (/Users/junger/dropbox/dev/test/node_modules/grunt-webpack/tasks/webpack.js:15:54)
  at Object.thisTask.fn (/Users/junger/dropbox/dev/test/node_modules/grunt/lib/grunt/task.js:70:16)
  at Object.<anonymous> (/Users/junger/dropbox/dev/test/node_modules/grunt/lib/util/task.js:294:30)
  at Task.runTaskFn (/Users/junger/dropbox/dev/test/node_modules/grunt/lib/util/task.js:244:24)
  at Task.<anonymous> (/Users/junger/dropbox/dev/test/node_modules/grunt/lib/util/task.js:293:12)
  at Task.start (/Users/junger/dropbox/dev/test/node_modules/grunt/lib/util/task.js:302:5)
  at Object.grunt.tasks (/Users/junger/dropbox/dev/test/node_modules/grunt/lib/grunt.js:155:8)
  at Object.module.exports [as cli] (/Users/junger/dropbox/dev/test/node_modules/grunt/lib/grunt/cli.js:27:9)
  at Object.<anonymous> (/Users/junger/dropbox/dev/test/node_modules/grunt-cli/bin/grunt:44:20)
  at Module._compile (internal/modules/cjs/loader.js:678:30)
  at Object.Module._extensions..js (internal/modules/cjs/loader.js:689:10)
  at Module.load (internal/modules/cjs/loader.js:589:32)
  at tryModuleLoad (internal/modules/cjs/loader.js:528:12)
  at Function.Module._load (internal/modules/cjs/loader.js:520:3)
  at Module.require (internal/modules/cjs/loader.js:626:17)
  at require (internal/modules/cjs/helpers.js:20:18)
  at Object.<anonymous> (/Users/junger/dropbox/dev/test/node_modules/grunt/bin/grunt:3:1)
  at Module._compile (internal/modules/cjs/loader.js:678:30)
  at Object.Module._extensions..js (internal/modules/cjs/loader.js:689:10)
  at Module.load (internal/modules/cjs/loader.js:589:32)
  at tryModuleLoad (internal/modules/cjs/loader.js:528:12)
  at Function.Module._load (internal/modules/cjs/loader.js:520:3)
  at Function.Module.runMain (internal/modules/cjs/loader.js:719:10)
  at startup (internal/bootstrap/node.js:228:19)
  at bootstrapNodeJSCore (internal/bootstrap/node.js:575:3)

Webpack/Grunt Configuration (webpack.config.js, webpack part of Gruntfile.js)

No config

Expected Behavior

Works

Current Behavior

Throws error

Possible Solution

Just a helpful check on grunt.config([this.name]).

Context

Run webpack using grunt

Your Environment

software version
webpack 4.16.1
grunt-webpack 3.1.2
grunt v1.0.3
node v10.0.0
npm 5.6.0
Operating System Mac
@danez
Copy link
Collaborator

danez commented Sep 1, 2018

This happens because you do not have a config. I added a fix that will display a proper warning.

@danez danez closed this as completed in 6326a10 Sep 1, 2018
@joshunger
Copy link
Author

Thanks @danez 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants