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.

Warning: The "to" argument must be of type string.

See original GitHub issue

Setup:

  • Windows 10
  • Node v10.15.3
  • npm 6.4.1
  • yarn 1.16.0
  • grunt 1.0.4

Gruntfile.js

module.exports = function(grunt) {
   require('load-grunt-tasks')(grunt);

   grunt.initConfig({

    babel: {
         dist: {
            files: {
               'js/app.js': 'js/app-compiled.js'
            }
         }
      },
   });

   grunt.registerTask("build", ["babel",]);
}

When i enter “grunt build” i receive respond: Warning: The "to" argument must be of type string. Received type undefined Use --force to continue. and only this. What is a “to” argument and why it isn’t be of type string? After all this is taken from the example and does not work.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6

github_iconTop GitHub Comments

6reactions
mread1208commented, Jan 24, 2020

I believe the error you’re getting is that Babel cannot compile fileA.js into fileB.js because fileA.js doesn’t exist.

In the files object of the config, the key should be the output file name and the value should be the name of the file you want converted (seems backwards, but it makes sense if you look at it this way).

So in your example:

files: {
    'js/app.js': 'js/app-compiled.js'
}

You’re trying to convert a file called js/app-compiled.js into js/app.js. I believe you have these backwards, you should have a file called js/app.js and you want grunt / babel to compile that into a new file called js/app-compiled.js. Update your config to look like this and make sure you have a file called app.js in the correct location:

files: {
    'js/app-compiled.js': 'js/app.js'
}
4reactions
jgaritecommented, Sep 5, 2019

@RiddickAbaddon I’m not sure if you realized it already, but i realized it shortly after i posted here. The source file was not created. In my case, I was using concat first and the output from concat didnt create a file. therefore, babel didn’t find any file to work with. not sure if this is the same issue you have, but once i had the file in place, everything went fine.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Gruntfile.js Warning: The "path" argument must be of type ...
Warning : The "path" argument must be of type string. Received type object Use --force to continue. Aborted due to warnings. Process terminated ......
Read more >
[err_invalid_arg_type]: the "path" argument must be of type ...
In Node 15 brfs throw error The "path" argument must be of type string or an instance of Buffer or URL. Received undefined...
Read more >
[Fix] TypeError [ERR_INVALID_ARG_TYPE]: The “path ...
Have you run into the error “TypeError [ERR_INVALID_ARG_TYPE]: The “path” argument must be of type string. Received undefined”? In this story I'll go...
Read more >
Pipelines fail randomly with ##[error]TypeError ...
Pipelines fail randomly with ##[error]TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined.
Read more >
The "path" argument must be of type string - SAP Community
I have found such warning when Workspace is created: Problems loading reference 'vscode://schemas/workspaceConfig': Unable to load schema from ' ...
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