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

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

Open
selvamani-subramani opened this issue Jan 12, 2018 · 1 comment

Comments

@selvamani-subramani
Copy link

selvamani-subramani commented Jan 12, 2018

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

@soundarmoorthy
Copy link

soundarmoorthy commented Nov 1, 2018

I am facing the same issue :-) on a Mac.
Node version 11.
5 "devDependencies": {
6 "grunt": "^0.4.5",
7 "grunt-contrib-jshint": "^0.10.0",
8 "grunt-contrib-sass": "^0.8.0",
9 "grunt-contrib-watch": "^0.6.1",
10 "grunt-text-replace": "^0.3.12",
11 "js-yaml": "3.2.*",
12 "load-grunt-tasks": "^3.1.0",
13 "moment": "^2.9.0"
14 },
21 "directories": {
22 "test": "test"
23 },
24 "scripts": {
25 "test": "echo "Error: no test specified" && exit 1",
26 "build": "node -e "require('grunt').tasks(['build']);""
27 },

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