I've currently got gulp in the devDependencies section of my package.json:
...
"gulp": "^3.9.0",
...
But when I go to run npm run gulp I get:
npm ERR! Linux 3.19.0-21-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "run" "gulp"
npm ERR! node v0.12.5
npm ERR! npm v2.11.2
npm ERR! missing script: gulp
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! /home/somewhere/npm-debug.log
I'm trying to get things to the point where I don't have to install all the various nodejs-based tools globally on my build server. Would also help when onboarding so that people don't keep running aground of missing tools.
I think that isn't a gulp issue. It's requirement of every nodejs CLI app. And actually is just needed to do the symlinks (something more?).
Also, gulp's CLI is separate package (from v4+), so you cant just include gulp in devDeps.
I'm trying to get things to the point where I don't have to install all the various nodejs-based tools globally on my build server.
You cant. You should have them installed globally to have access to them, there's no other way for me atm.
You can npm install gulp locally and access the CLI via node_modules/.bin/gulp (which npm scripts will already do for you if you put gulp in a script) - not sure what the problem is here? You absolutely don't need to install it globally.
@contra He's trying to do npm run gulp from the shell.
@atrauzzi npm run is for arbitrary entries in package.json's scripts. You can do what @contra said, or I think you might be able to get close to what you want with something like this in package.json (but then options passing gets a bit gnarly):
"scripts": {
"gulp": "gulp"
}
access the CLI via node_modules/.bin/gulp
Currently, yea. But won't work in upcoming v4, i think.
Gulp is not making an entry in the .bin directory though, that's the problem here I suspect.
@atrauzzi
[charlike@dev kind-error]$ ls -ls node_modules/.bin/
total 0
0 lrwxrwxrwx. 1 charlike charlike 19 Jul 01 21:33 gulp -> ../gulp/bin/gulp.js
@atrauzzi If you don't have the entry in the .bin directory, I don't know why that is. But even if you do, I don't think npm run gulp is going to do anything without the package.json data I talked about.
@jmm is correct, npm run only works with scripts. They are investigating exposing an npm exec command that will run a local bin but that doesn't exist yet. Also not sure why you don't have a local bin. We plan to keep that in gulp4 if npm3 works the expected way with conflicting bins
@jmm - I've added the entry and still no dice. I'm unable to invoke gulp via npm run gulp.
Again, are you sure this isn't because a file isn't created in .bin?
$ ls node_modules/.bin/ -Al
total 0
lrwxrwxrwx 1 atrauzzi atrauzzi 15 Jul 1 10:48 jspm -> ../jspm/jspm.js
(JSPM works fine, it's only gulp that seems to be missing here in my current setup)
Update: I flushed ~/.npm and node_modules, suddenly the gulp command appears.
Gotta love nodejs ;)
@atrauzzi glad you got it fixed. all the contribs have other stuff going on so we are unable to triage node/npm related problems. These types of problems are always related to npm cache or something outside of gulp's control. Again, glad you got it solved.
Yeah, I should have tried flushing everything first. No stranger to these kinds of oddities. At least now we have a record of what worked!
Gotta love nodejs ;)
It is driving me bat shit crazy. About as much fun as hitting yourself on the head with a hammer and thinking how good it will feel when you stop.
How do I flush ~/.nmp and node_modules?
Most helpful comment
@contra He's trying to do
npm run gulpfrom the shell.@atrauzzi
npm runis for arbitrary entries inpackage.json'sscripts. You can do what @contra said, or I think you might be able to get close to what you want with something like this inpackage.json(but then options passing gets a bit gnarly):