remy / nodemon

Monitor for any changes in your node.js application and automatically restart the server - perfect for development
http://nodemon.io/
MIT License
26.22k stars 1.72k forks source link

The token '||' is not a valid statement separator in this version. #2007

Closed ArmaanTechDeveloper closed 2 years ago

ArmaanTechDeveloper commented 2 years ago

nodemon isn't installing on my project

Expected behaviour

npm should install nodemon and save it to the dev dependencies

Actual behaviour

shows the error

npm ERR! code 1 npm ERR! path C:\Users\Armaan\AppData\Roaming\npm\node_modules\nodemon npm ERR! command failed npm ERR! command powershell -c node bin/postinstall || exit 0 npm ERR! At line:1 char:22 npm ERR! + node bin/postinstall || exit 0 npm ERR! + ~~ npm ERR! The token '||' is not a valid statement separator in this version. npm ERR! + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException npm ERR! + FullyQualifiedErrorId : InvalidEndOfLine

Steps to reproduce

idk


If applicable, please append the --dump flag on your command and include the output here ensuring to remove any sensitive/personal details or tokens. image

remy commented 2 years ago

What's your powershell version? (Not sure it'll help, but it help)

ArmaanTechDeveloper commented 2 years ago

What's your powershell version? (Not sure it'll help, but it help)

actually i figured out the issue The issue is in the powershell which npm is using by default even if you try to install nodemon from command prompt you get the same error because npm in the background is using powershell inside cmd too

so i changed the default shell used by npm to command prompt using - "npm config set script-shell cmd" and then the installation works after the installation gets complete i reverb back to the default powershell using - "npm config set script-shell powershell"

For those who are having the same issue i have attached a list of commands in the picture (refer to that and hopefully your issue gets fixed) image also remy , if it can be fixed then try to fix it please ( if you want to generate this error put your command shell to powershell and then try to install it ) powershell version i am using is - 5.1.19041.1645

github-actions[bot] commented 2 years ago

This issue has been automatically marked as idle and stale because it hasn't had any recent activity. It will be automtically closed if no further activity occurs. If you think this is wrong, or the problem still persists, just pop a reply in the comments and @remy will (try!) to follow up. Thank you for contributing <3

github-actions[bot] commented 2 years ago

Automatically closing this issue due to lack of activity

bektigalan commented 2 years ago

i already tried using cmd and powershell, even bash in windows 10 image i install it using yarn, problem solved, somehow