Ghost: npm test currently doesn't work without globally installing grunt-cli
npm test currently doesn’t work in a freshly cloned + npm installed repo because grunt-cli isn’t in devDependencies
commands in the scripts field of package.json e.g. {"scripts": {"start": "ghost"}} will resolve to the local module scope instead of requiring global installation. This means that working versions of modules can get bundled with applications.
for example, in the above example when npm start runs it will look for a module in the local available require scope that provides a ghost bin, and will use that. if it can’t find a local module it will try the $PATH.
if I had two applications on my computer that both depend on ghost, but one depends on ghost v1 and another on ghost v2 (for example), it would suck if I had to npm install -g ghost@1.0.0 every time I went into the first project and then npm install -g ghost@2.0.0 in the other one. using npm scripts solves this problem. (I hope my explanation makes sense)
About this issue
- Original URL
- State: closed
- Created 11 years ago
- Comments: 23 (12 by maintainers)
Commits related to this issue
- Adding submodule update to grunt init issue #1053 - not the greatest module, but perhaps one to re-create ourselves in future — committed to TryGhost/Ghost by ErisDS 11 years ago
- Adding submodule update to grunt init issue #1053 - not the greatest module, but perhaps one to re-create ourselves in future — committed to jptacek/Ghost by ErisDS 11 years ago
- Updated package.json to conform to npm standards fixes #1053 - fleshed out script object - added test and install package.json - updated contributing guide - updates travis.yml to leverage new npm... — committed to hswolff/Ghost by hswolff 10 years ago
- Update to `npm install` command fixes #1053 - npm install doesn't need a path to grunt, and fails on Windows if it has one - submodule update is handled by grunt (albeit badly... but let's fix that!... — committed to ErisDS/Ghost by ErisDS 10 years ago
- Fix package.json scripts to be more in line with expected behavior of npm packages fixes #1053 - updates travis config to be more in line with current dev steps - fix `grunt-cli` warning from appe... — committed to hswolff/Ghost by hswolff 10 years ago
- 🐛 Fixed various editor issues (#18934) refs https://github.com/tryghost/ghost/issues/18752, https://github.com/TryGhost/Product/issues/3897, https://github.com/TryGhost/Product/issues/4112,https://g... — committed to TryGhost/Ghost by kevinansfield 8 months ago
- 🐛 Fixed various editor issues (#18934) refs https://github.com/tryghost/ghost/issues/18752, https://github.com/TryGhost/Product/issues/3897, https://github.com/TryGhost/Product/issues/4112,https://g... — committed to TryGhost/Ghost by kevinansfield 8 months ago
It works for me on OSX 10.9.1 and node.js v0.10.22, ruby-2.0.0-p247.
I did a fresh
rm -rf Ghost && git clone git://github.com/TryGhost/Ghost && cd Ghost,npm i(which ranbundle install && grunt initfrom the npm install hook). Thennpm startI then removed my globally installed grunt-cli with
npm uninstall -g grunt-cliand repeated the above.- npm install -g grunt-cliin the before_install of the.travis.ymlis no longer needed. Also in the contributing guidelines,1. Run npm install -g grunt-cliis no longer needed. As well asgrunt initas that will be ran automatically when the user doesnpm install.The message:
>> Local Npm module "grunt-cli" not found. Is it installed?comes from trying to loadgrunt-clias a grunt task. Simply change the matchdep line in the Gruntfile.js torequire('matchdep').filterDev(['grunt-*', '!grunt-cli']).forEach(grunt.loadNpmTasks);to avoid loadinggrunt-clias a grunt task.Happy to send a PR for any of the above if that is easier. Thanks!