Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'\"node build\bundle.js\"' is not recognized as an internal or external command, operable program or batch file

I setup some scripts in package.json as follows:

  "scripts": {
    "dev:server": "nodemon --watch build --exec \"node build/bundle.js\"",
    "dev:build:server": "webpack --config webpack.server.js --watch"
  },

but I get the following error when I run npm run dev:server

[nodemon] 1.12.0
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: C:\Users\adinu\Documents\Dev\React Training Code\Udemy\Code\server\build/**/*
[nodemon] starting `node build/bundle.js`
'\"node build\bundle.js\"' is not recognized as an internal or external command,
operable program or batch file.
[nodemon] app crashed - waiting for file changes before starting...  

If I run node build/bundle.js directly from the terminal, I get no errors.

I also checked the standard things like making sure nodejs is in the path, re-started the machine etc.

Thanks

Alex

like image 665
user1786037 Avatar asked Jul 12 '26 02:07

user1786037


1 Answers

To make sure it works in windows, use the script as follows: remove the \" ... \" code around.

"scripts": {
        "dev:server": "nodemon --watch build --exec node build/bundle.js",
        "dev:build:server": "webpack --config webpack.server.js --watch"
},
like image 101
Harshavardhan Avatar answered Jul 13 '26 16:07

Harshavardhan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!