[Resolved] grunt assertion `args[1]->isstring()’ failed.

Grunt is a powerful tool to create build files for production and development. A few days back I was handed over an old AngularJs project which was developed by some earlier teams. I was struggling to create build and learned some new technologies while resolving the process like Yoeman. Just writing it up to share…

By.

•

min read

Grunt is a powerful tool to create build files for production and development. A few days back I was handed over an old AngularJs project which was developed by some earlier teams.

I was struggling to create build and learned some new technologies while resolving the process like Yoeman. Just writing it up to share with anybody to save some time and facing the same issues.

First, let’s check what is Yoeman.

Yeoman is an open source client-side scaffolding tool for web applications. Yeoman runs as a command-line interface written for Node.js and combines several functions into one place, such as generating a starter template, managing dependencies, running unit tests, providing a local development server, and optimizing production code for deployment.

So basically I faced the following two issues:

 

Issue 1#

Can’t find config file: .jshintrc

Running "jshint:all" (jshint) task
ERROR: Can't find config file: .jshintrc

This issue is caused when there is no file looking like .jshintrc . This file is created by Yoeman to have a configuration on how to check files for common obvious errors.

In the Gruntfile.js when we have a block as shown below:

...
   // Make sure there are no obvious mistakes
    jshint: {
      options: {
        jshintrc: '.jshintrc',
        reporter: require('jshint-stylish')
      },
      all: {
        src: [
          'Gruntfile.js',
          '<%= yeoman.app %>/scripts/{,*/}*.js'
        ]
      },
      test: {
        options: {
          jshintrc: 'test/.jshintrc'
        },
        src: ['test/spec/{,*/}*.js']
      }
    },
...

Then this issue is caused.

Solution 1: Just comment out the jshint: {...} block

Solution 2: Create a new file .jshintrc at project root. You can get a reference from this about default configuration properties.

In my case, I just added {} in the .jshintrc file 😛 as I was just supposed to make a small change and create a build in no time.

 

 

Issue 2#

grunt assertion `args[1]->isstring()’ failed.

Solution: Just delete node_modules folder and package-lock.json file at project root and run following npm command

$ npm install --unsafe-perm=true

After that, you can run the grunt command easily and create the dist folder.

Source Link

 

Hope this post will help in case you are also stuck due to these common issues.

Leave a Reply

Your email address will not be published. Required fields are marked *