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.
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. the steps are small in number but confusing !

  2. nice content. allso . also do well to check out my java 9 brief tutorial

    Java 9 also known as JDK 1.9 is a major release of java programming language development. The initial release was out on the 21st of September 2017. As a java developer, whether beginner, intermediate or professional, it is expedient that you come to understand the four main goals of Java 9 release.

    New features of JAVA 9 programming language development
    There are a lot of enhancements that were added to Java 9, we are only going to pay attention to the most significant ones as highlighted below −
    Module − A new kind of Java programing component introduced as a module, which is a named, self-describing collection of code and data.
    REPL (JShell) − Read-Eval-Print Loop (REPL) capability added to the Java platform.
    HTTP 2 Client − new HTTPClient API supporting WebSockets and HTTP 2 streams and server push features.
    Improved JavaDocs − Supports HTML5 output generation. Provides a search box to generated API documentation.
    Multi release JAR − Enhances the JAR format so that multiple, Java release-specific versions of class files can coexist in a single archive.
    Collection Factory Methods − New static factory methods for List, Set, and Map interfaces to create immutable instances of those collections.
    Private Interface Methods − Enhanced interfaces with private and private static methods.
    Process API Improvements − Improved API to control and manage operating system processes.
    Stream API Improvements − Enhanced security and robustness by allowing incoming streams of object-serialization data to be filtered.
    Try With Resources improvement − Now final variables can be used as resources in the try-with-resources statement.
    Enhanced @Deprecated Annotation − @Deprecated annotation revamped to provide more information about the status and intended disposition of an API.
    Inner Class Diamond Operator − Allow the diamond operator to be used with anonymous classes if the argument type of the inferred type can be denoted.
    Optional Class Improvements − New useful methods are added to java.util.Optional class.
    Multiresolution Image API − Supports encapsulation of a set of images with different resolutions into a single multiresolution image.
    CompletableFuture API improvements − The asynchronous mechanisms of the CompletableFuture class can perform an action when the process exits with ProcessHandle.onExit method.
    Lightweight JSON − A lightweight API introduced to consume and generating documents and data streams via JSON in java 9.
    Reactive Streams API − A new Reactive Streams API in Java SE 9 has been introduced to support reactive programming in java 9.

    How to set up a development environment for java 9
    Local Environment Setup
    If you want to set up your own environment for Java programming language, then this section would teach you all you need to know. Please endeavour to follow the following steps so that you can know more about what it takes, and what you need to set up your java environment.
    Java SE is can be downloaded online for free. Please click here, to download a version compatible with your operating system.