Skip to content

Loading "jshint.js" tasks...ERROR. TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string #277

@selvamani-subramani

Description

@selvamani-subramani

When I run build after npm install I am getting this error. But if I install grunt globally and run grunt build it passes the task.

This is package.json

{
  ...
  "devDependencies": {
    "grunt": "^0.4.5",
    "grunt-contrib-sass": "^0.8.0",
    "grunt-contrib-watch": "^0.6.1",
    "grunt-text-replace": "^0.3.12",
    "js-yaml": "3.2.*",
    "load-grunt-tasks": "^3.1.0",
    "moment": "^2.9.0",
    "grunt-contrib-jshint": "^0.10.0"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "build": "node -e \"require('grunt').tasks(['build']);\""
  }
  ...
}

I am getting the below error when I run npm run build

Loading "jshint.js" tasks...ERROR
>> TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string
Warning: Task "jshint" not found. Use --force to continue.

Aborted due to warnings.
npm ERR! code ELIFECYCLE
npm ERR! errno 3
npm ERR! [email protected] build: `node -e "require('grunt').tasks(['build']);"`
npm ERR! Exit status 3
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/Mac/.npm/_logs/2018-01-12T04_27_38_104Z-debug.log

gruntfile.js

module.exports = function(grunt) {

  require('load-grunt-tasks')(grunt);

  grunt.initConfig({
   ...
  });

  // Register Task Aliases
  grunt.registerTask('styles', ['sass', 'replace']);
  grunt.registerTask('base', ['jshint', 'styles']);
  grunt.registerTask('build', ['base', 'yaml']);
  grunt.registerTask('default', ['base', 'watch']);

};

When I included require('load-grunt-tasks')(grunt); the error occurred. When I replace to require('load-grunt-tasks')(grunt, {pattern: ['grunt-*', '@*/grunt-*', "!grunt-contrib-jshint"]});, error gone.

#277

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions