Attempting to install gitbook-cli has resulted in an error. It seems that the 'gitbook-cli -

After completing the installation of Node.js, npm, and Gitbook-cli, I encountered an error that looks like this:

[root@vagrant-centos65 vagrant]# gitbook -v

/usr/lib/node_modules/gitbook-cli/node_modules/fs-extra/lib/index.js:3
const assign = require('./util/assign')
^^^^^
SyntaxError: Use of const in strict mode.
    at Module._compile (module.js:439:25)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/usr/lib/node_modules/gitbook-cli/lib/config.js:2:10)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
[root@vagrant-centos65 vagrant]# npm -v
1.3.6
[root@vagrant-centos65 vagrant]# node -v
v0.10.48

My current versions for Node.js and npm are v0.10.48 and 1.3.6 respectively. Can anyone provide assistance on how to resolve this issue?

Answer №1

According to this explanation, the use of const is not enabled by default in node.js version 0.10 and requires the --harmony flag for implementation.

The error you encountered is likely due to the use of the const keyword in the index.js file of this specific version of the fs-extra package.

You can refer to this compatibility table for an overview of the support levels for const and let based on node.js versions.

Solving this issue may simply require upgrading your node.js version.

Furthermore, running gitbook as a root user may not be advisable.

Answer №2

Big thank you to TGrif for the help with Node.js update! Successfully upgraded my nodejs and everything is running smoothly.

npm cache clean -f
npm install -g n
n stable
ln -sf /usr/local/n/versions/node/8.0.0/bin/node /usr/bin/node

Need help updating your Node.js version? Check this out!

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

There seems to be an issue with the connection between socket.io and the server

Recently, I encountered an issue while hosting my application on OpenShift with a custom domain. The problem arose when socket.io failed to download the client-side script, leading me to resort to using a CDN instead. However, this workaround has caused an ...

Execute npm command within an alternate directory using Docker

I am looking to execute the command npm install within a container, but simply using docker exec container npm install is not suitable for my needs. I specifically want to run this command in the directory /home/client, however, the working directory in t ...

Getting JSON object string in Node.js using Express

I am currently utilizing Polymer's <iron-ajax> to send data, in the form of a JSON string created using JSON.stringify, to a Node Express server. However, upon receiving the data, it appears in a strange format that I am unable to parse. Specifi ...

Error in Winston: Unable to determine the length of undefined property

I encountered an issue with my Winston Transport in the express backend of my MERN app. The error message reads: error: uncaughtException: Cannot read property 'length' of undefined TypeError: Cannot read property 'length' of undefi ...

Avoid installation for specific dependency

Is it possible to exclude a specific dependency when running npm install? For example: npm install --exclude=lodash --exclude=rxjs In my situation, I have some developer tools and certain dependencies may not be available in the NPM registry yet, so I n ...

Differences between app.get(name) and app.get(path, [callback...], callback) when using ExpressJSWhen

Just starting out with Express and after reading through the API documentation, it appears that there are two app.get() methods. One is used to retrieve the value of a variable, while the other is typically used to handle HTTP GET requests. What sets thes ...

Is there a way to ensure that no one can duplicate a username in mongoDB?

I am facing an issue with a form where users are required to input their nickname. The challenge is that I need each nickname to be unique, meaning no two users should have the same nickname. Is there a solution to this that only involves using MongoDB a ...

Steps to ensure that MongoClient is accessible globally on all pages within a Node.js REST API

After researching the official MongoDB documentation, I have successfully integrated mongoDB into my NodeJS REST API using the following connection code. const { MongoClient } = require("mongodb"); // Connection URI const uri = "mongodb+s ...

Start numerous nodejs servers with just a single command

I currently have multiple Nodejs servers, each stored in its own separate folder within a root directory. Whenever I need to run these servers, I find it cumbersome to navigate through each folder and manually type nodemon *name*. The number of servers i ...

When trying to run the command "npm {package} --save-dev" in the terminal, it

I attempted to execute the following commands: $npm install mocha --save-dev and then $mocha However, I received this error message: $-bash: mocha: command not found If I install it globally, it works. But is there a way to use a specific package ve ...

Utilizing Node Express for RESTful API creates a seamless error handling system

I have been working on developing a series of RESTful API services using Node.js Express. Whenever an error occurs, it is accompanied by a stack-trace with the following message: Error: No default engine was specified and no extension was provided. I h ...

Ensuring uniformity in simultaneous read actions within MongoDB

I have a Node.js API called /create/appointment that performs two operations: STEP 1: Checking for an active appointment in the database. STEP 2: Creating an appointment if it does not exist. There are three collections: doctors patients appointments ...

Obtain the initial Firebase child element without a specific key

Trying to access the first child of a firebase object is my current challenge. The reference is structured as follows: var sitesToVisitRef = firebase.database().ref('sitesToVisit') The reference is confirmed functional as I am able to write to ...

Protactor has been successfully integrated with Pdf2json, allowing for seamless

Is there anyone out there who has successfully integrated the pdf2json npm package with Protractor? I have managed to develop a standalone node application that can convert PDF files to JSON format. My next goal is to incorporate pdf2json into my protract ...

Leverage the power of ssh2-promise in NodeJS to run Linux commands on a remote server

When attempting to run the command yum install <package_name> on a remote Linux server using the ssh2-promise package, I encountered an issue where I couldn't retrieve the response from the command for further processing and validation. I' ...

What's the deal with Mongoose and preloading data?

There is an issue I am facing with regards to retrieving a document from mongodb. In my node.js server configuration, I have the following call: app.get('/ruimtes/:afkortingCampus', function (req, res) { Ruimtes.find({'campusAfkorting&apo ...

Navigate to an error page if the query does not find a match in the Node.js, Express, and MongoDB stack

I'm currently working on a website form that pulls information from a MongoDB database, similar to accessing a library catalog. My stack includes NodeJS, Express, MongoDB, and EJS views. While the code is functioning properly overall, I want to imple ...

Whenever I try to run the npm run dev function on my Ubuntu operating system, I always

After running the npm run dev function, I encountered an error. Just a day ago, everything was working fine. Can someone please help me understand why this error is occurring? Below is the full error response. I would appreciate any assistance as I have sp ...

Executing the command "npm run script" produces no results

I find it strange that I have the following scripts in my package.json file: "scripts": { "lint": "./node_modules/tslint/bin/tslint src/js/**/*", "lint:fix": "./node_modules/tslint/bin/tslint src/js/**/* --fix" }, When I execute npm run lint, I do ...

Start line error in Node.js OpenSSL

Working on my app using node.js for the german Sparkasse (a banking provider) has been quite a challenge. They offer an API for their services, which you can check out here. One of the steps involves obtaining a RSA-2048-SHA1 public key from their ser ...