Wednesday, January 25, 2012

NodeJs: npm ERR! JSON.parse package.json must be actual JSON, not just JavaScript.

If you are working in windows go through in following.

npm ERR! JSON.parse Failed to parse package.json data.
npm ERR! JSON.parse package.json must be actual JSON, not just JavaScript.

It's occur either invalid JSON format or file created via Notepad by save as.
To avoid this, create a empty JSON file in DOS-Command Prompt (edit/copy con command) or here my simple way is,
1. Create a BAT file (.bat extension) and write the following command without double-quotes.
 ">package.json".
2. Copy the file to your module folder.
3. Run the BAT file. This will create a actual JSON file. Then write following line of code to make your NodeJs module installable.


Note: Please write your queries and suggestion as comment.

1 comment: