RM1970 RM1970 - 3 months ago 25
Node.js Question

GRUNT installs without package.json

npm install -g grunt-cli
npm install --save-dev grunt grunt-contrib-concat grunt-contrib-uglify grunt-sass grunt-contrib-less grunt-contrib-watch


But no package.json is ever created in the folder where I ran those commands.

When I run grunt from command line:

>> Error: Unable to read "package.json" file (Error code: ENOENT).


What am I doing wrong?

Answer

When I run grunt from command line:

>> Error: Unable to read "package.json" file (Error code: ENOENT).

None of the commands you ran would have created a package.json file, so unless you manually created a file named "package.json" including an empty JSON object ({}), it makes sense that the commands would fail to save the dependencies in the package.json file.

If you run npm init from command line, it'll create a package.json file with basic settings.