I'm following a VUE tutorial on a mac (shown in youtube).
In my src/app.js
I have only console.log('hi');
The start command for the Mac in package.json
as shown on the youtube video is:
"scripts": {
"start": "./node_modules/nodemon/bin/nodemon.js src/app.js --exec 'npm run lint && node'",
"lint": "./node_modules/.bin/eslint **/*.js"
},
In which case the nodemon was not found.
So I changed the forward slashes to backslashes thus:
"scripts": {
"start": ".\\node_modules\\nodemon\\bin\\nodemon.js src\\app.js --exec 'npm run lint && node'",
"lint": ".\\node_modules\\.bin\\eslint **\\*.js"
},
but now when I run npm start
I get an alert with error in nodemon.js
line 1
charachter 1
invalid character
800A03F6
I tried with a forward slash in the src/app.js and got the same error. Is it something to do with the single quotemark?
The tutorial is here: (start command seen at 21:43) here: https://www.youtube.com/watch?v=Fa4cRMaTDUI&t=21m43s
OK, the solution was to install nodemon globally
npm i -g nodemon
And then changing the start string to
"start": "nodemon src/app.js --exec 'node && lint'"
Without it, running nodemon.js directly, even when I was inside the bin
folder, was giving that error.
Nodemon version was and still is: 1.18.4 in both the local and global install.
Also, I had to change the single quotes in the --exec to escaped double quotes.
Instead of: "start": "nodemon src/app.js --exec 'npm run node && lint'"
I now have: "start": "nodemon src/app.js --exec \"npm run node && lint\""
Calling the .js was the problem.
There is a nodemon.cmd
command, in the users\<myuser>\AppData\Roaming\npm
folder, which is in the windows 10 environment %PATH%.
There probably was a nodemon.cmd
that I could call when installed locally. But don't ask me where that is.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With