Spent quite a number of hours trying to find this thing out but to no avail. I'm sure it's as simple as syntax but maybe I've been staring at the problem for too long. I'm trying to build out a development environment for an old piece of code. Refactoring is not an option because of the size of the codebase currently.
The biggest issue of course is the fact that I'm trying to mimic an environment that was built out 11 months ago, and need the following
node v0.6.11 npm v1.1.1 brunch v0.8.1 coffee-script v1.2
package.json currently has
"dependencies": {
"coffee-script": ">= 1.1.1",
"underscore": ">= 1.1.7",
"eco": ">= 1.0.3",
"nomnom": "1.0.0",
"stylus": ">= 0.13.7",
"async": ">= 0.1.9",
"yaml": ">= 0.2.1",
"file": ">= 0.1.1",
"stitch": ">= 0.3.2",
"uglify-js": ">= 1.0.6"
},
"devDependencies": {
"coffee-script": ">= 1.1.1",
"express": ">= 2.4.3",
"nodeunit": ">= 0.5.3",
"zombie": ">= 0.9.7"
}
The issue of course is that the coffeescript that was originally installed was 1.4 and I need the be compiling with 1.2. I've tried changing the package.json to be "coffee-script": "1.2" in the dependencies section and then ran "cake setup". But that didn't change anything. Where am I going wrong here or am I approaching this all wrong?
I have a local copy of the correct version of coffee-script (1.2) on the same system but I don't know how to point brunch to use that one instead of the one installed in it's subdirectory.
Any help is appreciated. Thanks
npm
can install dependencies locally in the node node_modules
alongside your project's package.json
file or globally if you run npm install
with the -g
flag (often in /usr/local/lib/node_modules/
).
As you noticed, it appears like you have a different version of coffee-script installed globally vs locally and you'd like to force brunch-0.8.1 to use coffee-script 1.2. Here's what I'd try:
coffee-script
to 1.2
in the package.json
.node_modules
directory in the directory with the package.json
you just edited.npm install
in the same directory, which will read the edited package.json file with the updated version and re-install all dependencies in node_modules
.These steps will set your local copy of coffee-script to 1.2. Confirm this by looking at the version
attribute in node_modules/coffee-script/package.json
.
This still might not work, however:
cake setup
command could be trying to execute the global version of coffee-script. I'm not sure about the particulars of how the cake setup
task is looking for coffee-script, but if it does work with locally-installed versions you should be good to go.
If not, you'd need to do an npm uninstall -g coffee-script
and follow it with an npm install -g npm install coffee-script@1.2
This will set your global version of coffee-script to 1.2
.
Hope this helps. Figuring out dependency stuff in npm can be tricky, but when in doubt looking at package.json
file versions and running npm list <package name>
can be useful.