Error code: 800A1391 Source: Microsoft JScript runtime error Running Grunt - Module is undefined

前端 未结 9 1314
臣服心动
臣服心动 2021-01-03 22:21

New Grunt user here who is using a lot of new tools (npm nodejs) today.

I\'ve got Grunt \"installed\" and have been able to create a grunt.js file using the init tas

相关标签:
9条回答
  • 2021-01-03 22:24

    SOLVED !!

    So, this problem occur because windows by default associative < *.js > files with >> "Microsoft Windows Based Script Host".

    grunt need to open by default with (grunt.cmd).

    it easy to slove, by change default app (open with..)


    Guide :

    1. Go to any javascript file with "js" extension. (any file)

    2. Right-Click(mouse) > Properties > "Opens with:" Change...(button)

    3. Choose Notepad ( or any javascript IDE ).

    PROBLEM SOLVED ! :) good luck

    0 讨论(0)
  • 2021-01-03 22:27

    To answer this, first we need to understand that the error is caused because it is being executed by Windows Script Host.

    Now, run the code from your cmd promt with the following syntax:

    >node <application_name>.js
    

    this will allow the Node.js application to open through V8 JavaScript engine(Google's).

    P.S: Please reply back if this has helped in resolving your issue else post the problem you are facing after trying this.

    0 讨论(0)
  • 2021-01-03 22:28

    I went through the same issue when running an old Node project.

    The issue was with the name of the js file, it was node.js. So the while running the command node node.js, it was opening up a windows dialogue box.

    I just changed the name of the file to app.js and the error flew away.

    0 讨论(0)
  • 2021-01-03 22:30

    So, in my case i had tryed all the mentioned above with no result. But i have fund that im dont type: node in the full sentence as the following snipet node script.js.And remember never understimate your own miscoding.

    0 讨论(0)
  • 2021-01-03 22:44

    As Florian F suggested, running grunt.cmd works. This is because of the process Windows is looking for your grunt command.

    When typing grunt -h Windows will proceed to look for the following files:

    1. ./grunt.cmd
    2. ./grunt.* (grunt.js is found in this case which is why you see "module is undefined")
    3. %APPDATA%/npm/grunt.cmd

    An alternative to using "grunt.cmd" is to use grunter which simply renames the command to grunter... then you no longer have this problem.

    0 讨论(0)
  • 2021-01-03 22:45

    it seems that in the latest versions of the grunt modules, you would have to do the following to have it work under windows:

    remove any globally installed grunt

    npm uninstall -g grunt
    

    install grunt-cli globally

    npm install -g grunt-cli
    

    install grunt locally into your project

    npm install grunt
    

    installing grunt (v0.4.x) globally does not seem to create the necessary grunt.cmd anymore. it seems that the recommendation is now to have grunt installed locally to be able to use version-specific Gruntfiles

    0 讨论(0)
提交回复
热议问题