1

以下のように、ノード アプリ (ノード バージョン -4.2.2、npm バージョン - 2.14.7) に gruntfile があります。

 // watch node server for changes
            nodemon: {
                default: {
                    script: 'server.js'
                }
            },

コマンドを実行grunt すると、次のようなエラーがスローされます。

[nodemon] starting `node server.js`
Debugger listening on port 5858
 module.js:339
    throw err;
    ^

Error: Cannot find module 'C:\workspace\start.js'
    at Function.Module._resolveFilename (module.js:337:15)
    at Function.Module._load (module.js:287:25)
    at Function.Module.runMain (module.js:467:10)
    at startup (node.js:136:18)
    at node.js:963:3
 [nodemon] app crashed - waiting for file changes before starting...

以下のように、アプリのルートに gruntfile.js と server.js ファイルの両方があります。

C:\workspace\myApp
   - gruntfile.js
   - server.js

以下のように grunfile.jsのスクリプト ファイル パスを変更すると、機能します。

 // watch node server for changes
            nodemon: {
                default: {
                    script: 'myApp/start.js'
                }
            },  
4

0 に答える 0