Making "sudo npm install --save-dev gulp" in Maverics nothing's happens

I'm trying to test Gulp and I find this problem.

  • I installed Gulp globally with: sudo npm install -g gulp.
  • Then I was created the folder: mkdir my-gulp
  • cd my-gulp
  • And the I try to do this: sudo npm install --save-dev gulp
  • It seems work fine, no errors, but my folder my-gulp continues empty.
  • I can see in console, this line: gulp@3.8.6 ../../node_modules/gulp And I thinkig the problem is here "../../", I think it must be "gulp@3.8.6 node_modules/gulp"

What do you think? Maybe is something about $PATH?

First, you should never run npm via sudo for local packages. (In fact, you shouldn't run it as root ever, but that's a different, more complex issue to solve.)

Second, you need to initialize NPM before you can install packages. It sounds like you didn't do this.

There's two ways:

  1. If you have an existing package.json, which contains the required information about a project, you can copy it into your folder, then edit in a text editor of your choice to get started. If the package.json includes existing dependencies, you can either remove them, or run npm i in the folder to install them.

  2. If you are starting fresh, run npm init to set up a new package.

Once you have a valid package.json, you can install packages into your application.


As to why you are seeing ../../gulp, I'm guessing you have a package.json further up the file tree somewhere.