Category: Nodejs

0

npm WARN Invalid name:

Have you received below error while doing npm install? npm install npm notice created a lockfile as package-lock.json. You should commit this file. npm WARN Invalid name: Foo Bar Solution: In your package.json, “name”...

0

How to run node script from BASH?

Below shell script is running a node script, which gets an object from package.json, updates the app version and writes it back to the package.json using node API. // foo.sh node <<EOF var fs...

0

How to read a file as a string in nodejs javascript?

Below code reads the file content in asynchronous manner and the content is returned in the string format and buffered format respectively. let fs = require(“fs-extra”); let path = require(“path”); fs.readFile(path.join(__dirname, “filePath”), “utf8”,(data, err)...