I'm attempting to follow along with a tutorial and learn a bit about node.js. I keep getting a weird error, though. After npm install stylus, I get this:
npm http GET https://registry.npmjs.org/stylus
npm http 304 https://registry.npmjs.org/stylus
npm http GET https://registry.npmjs.org/mkdirp
npm http GET https://registry.npmjs.org/
npm http GET https://registry.npmjs.org/cssom
npm http GET https://registry.npmjs.org/sax
npm http 304 https://registry.npmjs.org/mkdirp
npm http 304 https://registry.npmjs.org/debug
npm http 304 https://registry.npmjs.org/cssom
npm http 304 https://registry.npmjs.org/sax
stylus#0.41.0 node_modules/stylus
├── debug#0.7.4
├── mkdirp#0.3.5
├── cssom#0.2.5
└── sax#0.5.5
No errors, nothing warning me of the world's end, not even any red text. Then when I try to run the application node app.js I get ReferenceError: stylus is not defined on this line:
app.use(stylus.middleware(
{
src: __dirname + '/public'
, compile: compile
}
))
npm install just create JS files on disk.
You still need to call require() to load the file and create a local variable:
var stylus = require('stylus');
Related
I'm trying to run this HTML minifier from an Ubuntu command-line.
But I'm getting an error when I try to do so.
NodeJS and NPM installs fine:
root$ apt-get install -y nodejs npm
Reading package lists... Done
Building dependency tree
Reading state information... Done
nodejs is already the newest version.
npm is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Installing the html-minifier seems to work:
root$ npm install html-minifier -g
npm http GET https://registry.npmjs.org/html-minifier
<... SNIP ...>
npm http 304 https://registry.npmjs.org/source-map
/usr/local/bin/html-minifier -> /usr/local/lib/node_modules/html-minifier/cli.js
html-minifier#3.5.9 /usr/local/lib/node_modules/html-minifier
├── commander#2.14.1
├── ncname#1.0.0 (xml-char-classes#1.0.0)
├── relateurl#0.2.7
├── he#1.1.1
├── param-case#2.1.1 (no-case#2.3.2)
├── camel-case#3.0.0 (upper-case#1.1.3, no-case#2.3.2)
├── clean-css#4.1.9 (source-map#0.5.7)
└── uglify-js#3.3.12 (source-map#0.6.1)
I can see that the html-minifier is installed:
root$ which html-minifier
/usr/local/bin/html-minifier
root$ head -5 /usr/local/bin/html-minifier
#!/usr/bin/env node
/**
* html-minifier CLI tool
*
* The MIT License (MIT)
But when I try to run it, I get the following error:
root$ html-minifier
/usr/bin/env: node: No such file or directory
Why can't I run the html-minifier? What am I doing wrong? And how can I fix it??
On ubuntu, node is called nodejs. Two options I can see
Edit the file "/usr/local/bin/html-minifier" and change #!/usr/bin/env node to #!/usr/bin/env nodejs
Add a small script node to start nodejs for you, or try alias node=nodejs
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 years ago.
Improve this question
During the path on creating my chat application, I was trying to create my app.js file till I came across this easy/novice silly SyntaxError which I really don't think anything is wrong with it, but still causes issues for me to progress onwards, I tried adding additional parentheses, brackets or semicolons. But it wouldn't resolve itself :/
This is my app.js file:
var express = require('expres'),
//now in express you no longer create an http server automatically
//app variable is just a function that bundles together with basically everything in express
//for socket.io we need an http server object so, we need to create that manually
app = express(),
//create a variable called "server".
//requires http module, then "createServer" (creates a server) and then pass that data onto the "app" variable.
server = require('http').createServer(app),
//Then we need to create the socket functionality.
//create the variable called "io".
//The variable "io" which then requires "socket.io" and then we need to make it "listen".
//So this is why we need an http server, the parameter of "listen".
//socket.io listens to an http server object.
//So we need to pass it to "server"
io = require('socket.io').listen(server);
//Next: We actually need to tell the server itself on what port to listen on.
//Pick any available port, in this case "3000" within the option below.
server.listen(3000);
//After setting up the server
//We need to create a "route".
//Right now we can't access any pages.
//And this is where express makes somethings easier.
//Makes routing a bit easier.
//We are going to use the variable "app" . "get" function to get that variable which equals to the "express framework".
//Then we set the root directory "/" by a forward slash sign.
//So that's the first parameter on what the client is trying to access.
//And then just like without express we have a "function" with the "http request" and the "http response" as parameters.
app.get('/'), function(req, res){
//And then we declare the "http response" and . "sendfile" because, we are going to create a file called "index.html" that we want the client to get whenever it goes to "localhost:3000".
//Then create the "directory name" + the "index.html" web page.
res.sendfile(__dirname + '/index.html');
});
//Then to check if it works within command prompt execute the command: "node app.js"
//Which will run the javascript file.
And here is the result I get when I input the node app.js command!
I've installed socket.io by executing the command npm install socket.io but it still wouldn't help solve my issue. :/
C:\chatapplication>npm install socket.io
npm http GET https://registry.npmjs.org/socket.io/1.4.8
npm http 304 https://registry.npmjs.org/socket.io/1.4.8
unbuild socket.io#1.4.8
npm http GET https://registry.npmjs.org/engine.io/1.6.11
npm http GET https://registry.npmjs.org/socket.io-adapter/0.4.0
npm http GET https://registry.npmjs.org/socket.io-parser/2.2.6
npm http GET https://registry.npmjs.org/has-binary/0.1.7
npm http GET https://registry.npmjs.org/debug/2.2.0
npm http GET https://registry.npmjs.org/socket.io-client/1.4.8
npm http 304 https://registry.npmjs.org/socket.io-parser/2.2.6
npm http GET https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-2.2.6.tgz
npm http 304 https://registry.npmjs.org/engine.io/1.6.11
npm http 304 https://registry.npmjs.org/debug/2.2.0
npm http 304 https://registry.npmjs.org/socket.io-adapter/0.4.0
npm http 304 https://registry.npmjs.org/has-binary/0.1.7
npm http 304 https://registry.npmjs.org/socket.io-client/1.4.8
npm http GET https://registry.npmjs.org/engine.io/-/engine.io-1.6.11.tgz
npm http GET https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-0.4.0.tgz
npm http GET https://registry.npmjs.org/socket.io-client/-/socket.io-client-1.4.8.tgz
npm http GET https://registry.npmjs.org/has-binary/-/has-binary-0.1.7.tgz
npm http 200 https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-2.2.6.tgz
npm http 200 https://registry.npmjs.org/engine.io/-/engine.io-1.6.11.tgz
npm http 200 https://registry.npmjs.org/has-binary/-/has-binary-0.1.7.tgz
npm http 200 https://registry.npmjs.org/socket.io-client/-/socket.io-client-1.4.8.tgz
npm http 200 https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-0.4.0.tgz
npm http GET https://registry.npmjs.org/isarray/0.0.1
npm http GET https://registry.npmjs.org/socket.io-parser/2.2.2
npm http GET https://registry.npmjs.org/ms/0.7.1
npm http GET https://registry.npmjs.org/json3/3.3.2
npm http GET https://registry.npmjs.org/component-emitter/1.1.2
npm http GET https://registry.npmjs.org/benchmark/1.0.0
npm http GET https://registry.npmjs.org/base64id/0.1.0
npm http GET https://registry.npmjs.org/engine.io-parser/1.2.4
npm http GET https://registry.npmjs.org/ws/1.1.0
npm http GET https://registry.npmjs.org/accepts/1.1.4
npm http 304 https://registry.npmjs.org/socket.io-parser/2.2.2
npm http 304 https://registry.npmjs.org/isarray/0.0.1
npm http GET https://registry.npmjs.org/engine.io-client/1.6.11
npm http GET https://registry.npmjs.org/component-emitter/1.2.0
npm http GET https://registry.npmjs.org/component-bind/1.0.0
npm http GET https://registry.npmjs.org/indexof/0.0.1
npm http GET https://registry.npmjs.org/object-component/0.0.3
npm http GET https://registry.npmjs.org/to-array/0.1.4
npm http GET https://registry.npmjs.org/parseuri/0.0.4
npm http 304 https://registry.npmjs.org/json3/3.3.2
npm http 304 https://registry.npmjs.org/ms/0.7.1
npm http GET https://registry.npmjs.org/backo2/1.0.2
npm http 304 https://registry.npmjs.org/benchmark/1.0.0
npm http 304 https://registry.npmjs.org/base64id/0.1.0
npm http 304 https://registry.npmjs.org/component-emitter/1.1.2
npm http GET https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-2.2.2.tgz
npm http 304 https://registry.npmjs.org/engine.io-parser/1.2.4
npm http 304 https://registry.npmjs.org/ws/1.1.0
npm http GET https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz
npm http 304 https://registry.npmjs.org/engine.io-client/1.6.11
npm http 304 https://registry.npmjs.org/component-emitter/1.2.0
npm http 304 https://registry.npmjs.org/accepts/1.1.4
npm http 304 https://registry.npmjs.org/component-bind/1.0.0
npm http 304 https://registry.npmjs.org/indexof/0.0.1
npm http GET https://registry.npmjs.org/base64id/-/base64id-0.1.0.tgz
npm http 304 https://registry.npmjs.org/object-component/0.0.3
npm http GET https://registry.npmjs.org/component-emitter/-/component-emitter-1.1.2.tgz
npm http GET https://registry.npmjs.org/json3/-/json3-3.3.2.tgz
npm http GET https://registry.npmjs.org/ms/-/ms-0.7.1.tgz
npm http GET https://registry.npmjs.org/benchmark/-/benchmark-1.0.0.tgz
npm http 304 https://registry.npmjs.org/to-array/0.1.4
npm http 304 https://registry.npmjs.org/parseuri/0.0.4
npm http 304 https://registry.npmjs.org/backo2/1.0.2
npm http GET https://registry.npmjs.org/ws/-/ws-1.1.0.tgz
npm http GET https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-1.2.4.tgz
npm http GET https://registry.npmjs.org/engine.io-client/-/engine.io-client-1.6.11.tgz
npm http GET https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.0.tgz
npm http GET https://registry.npmjs.org/accepts/-/accepts-1.1.4.tgz
npm http GET https://registry.npmjs.org/component-bind/-/component-bind-1.0.0.tgz
npm http GET https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz
npm http GET https://registry.npmjs.org/object-component/-/object-component-0.0.3.tgz
npm http GET https://registry.npmjs.org/to-array/-/to-array-0.1.4.tgz
npm http GET https://registry.npmjs.org/parseuri/-/parseuri-0.0.4.tgz
npm http 200 https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-2.2.2.tgz
npm http 200 https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz
npm http 200 https://registry.npmjs.org/ms/-/ms-0.7.1.tgz
npm http 200 https://registry.npmjs.org/base64id/-/base64id-0.1.0.tgz
npm http 200 https://registry.npmjs.org/benchmark/-/benchmark-1.0.0.tgz
npm http 200 https://registry.npmjs.org/component-emitter/-/component-emitter-1.1.2.tgz
npm http 200 https://registry.npmjs.org/json3/-/json3-3.3.2.tgz
npm http 200 https://registry.npmjs.org/ws/-/ws-1.1.0.tgz
npm http 200 https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-1.2.4.tgz
npm http 200 https://registry.npmjs.org/engine.io-client/-/engine.io-client-1.6.11.tgz
npm http 200 https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.0.tgz
npm http 200 https://registry.npmjs.org/accepts/-/accepts-1.1.4.tgz
npm http 200 https://registry.npmjs.org/component-bind/-/component-bind-1.0.0.tgz
npm http 200 https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz
npm http 200 https://registry.npmjs.org/object-component/-/object-component-0.0.3.tgz
npm http 200 https://registry.npmjs.org/to-array/-/to-array-0.1.4.tgz
npm http 200 https://registry.npmjs.org/parseuri/-/parseuri-0.0.4.tgz
npm http GET https://registry.npmjs.org/json3/3.2.6
npm http GET https://registry.npmjs.org/debug/0.7.4
npm http GET https://registry.npmjs.org/component-emitter/-/component-emitter-1.1.2.tgz
npm http 304 https://registry.npmjs.org/json3/3.2.6
npm http 304 https://registry.npmjs.org/debug/0.7.4
npm http GET https://registry.npmjs.org/json3/-/json3-3.2.6.tgz
npm http 200 https://registry.npmjs.org/component-emitter/-/component-emitter-1.1.2.tgz
npm http GET https://registry.npmjs.org/debug/-/debug-0.7.4.tgz
npm http 200 https://registry.npmjs.org/json3/-/json3-3.2.6.tgz
npm http GET https://registry.npmjs.org/mime-types
npm http GET https://registry.npmjs.org/negotiator/0.4.9
npm http 304 https://registry.npmjs.org/negotiator/0.4.9
npm http 200 https://registry.npmjs.org/debug/-/debug-0.7.4.tgz
npm http GET https://registry.npmjs.org/after/0.8.1
npm http GET https://registry.npmjs.org/arraybuffer.slice/0.0.6
npm http GET https://registry.npmjs.org/base64-arraybuffer/0.1.2
npm http GET https://registry.npmjs.org/has-binary/0.1.6
npm http GET https://registry.npmjs.org/blob/0.0.4
npm http GET https://registry.npmjs.org/utf8/2.1.0
npm http GET https://registry.npmjs.org/negotiator/-/negotiator-0.4.9.tgz
npm http 304 https://registry.npmjs.org/mime-types
npm http 304 https://registry.npmjs.org/blob/0.0.4
npm http GET https://registry.npmjs.org/blob/-/blob-0.0.4.tgz
npm http 304 https://registry.npmjs.org/utf8/2.1.0
npm http GET https://registry.npmjs.org/options
npm http GET https://registry.npmjs.org/ultron
npm http 304 https://registry.npmjs.org/arraybuffer.slice/0.0.6
npm http 304 https://registry.npmjs.org/after/0.8.1
npm http 304 https://registry.npmjs.org/base64-arraybuffer/0.1.2
npm http 304 https://registry.npmjs.org/has-binary/0.1.6
npm http GET https://registry.npmjs.org/utf8/-/utf8-2.1.0.tgz
npm http 200 https://registry.npmjs.org/negotiator/-/negotiator-0.4.9.tgz
npm http 304 https://registry.npmjs.org/ultron
npm http GET https://registry.npmjs.org/arraybuffer.slice/-/arraybuffer.slice-0.0.6.tgz
npm http GET https://registry.npmjs.org/after/-/after-0.8.1.tgz
npm http GET https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.2.tgz
npm http GET https://registry.npmjs.org/has-binary/-/has-binary-0.1.6.tgz
npm http 200 https://registry.npmjs.org/blob/-/blob-0.0.4.tgz
npm http 200 https://registry.npmjs.org/has-binary/-/has-binary-0.1.6.tgz
npm http 200 https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.2.tgz
npm http 200 https://registry.npmjs.org/utf8/-/utf8-2.1.0.tgz
npm http 200 https://registry.npmjs.org/after/-/after-0.8.1.tgz
npm http 304 https://registry.npmjs.org/options
npm http GET https://registry.npmjs.org/better-assert
npm http 200 https://registry.npmjs.org/arraybuffer.slice/-/arraybuffer.slice-0.0.6.tgz
npm http 304 https://registry.npmjs.org/better-assert
npm http GET https://registry.npmjs.org/callsite/1.0.0
npm http 304 https://registry.npmjs.org/callsite/1.0.0
npm http GET https://registry.npmjs.org/mime-db
npm http GET https://registry.npmjs.org/has-cors/1.1.0
npm http GET https://registry.npmjs.org/ws/1.0.1
npm http GET https://registry.npmjs.org/xmlhttprequest-ssl/1.5.1
npm http GET https://registry.npmjs.org/parsejson/0.0.1
npm http GET https://registry.npmjs.org/parseqs/0.0.2
npm http GET https://registry.npmjs.org/component-inherit/0.0.3
npm http GET https://registry.npmjs.org/yeast/0.1.2
npm http GET https://registry.npmjs.org/component-emitter/-/component-emitter-1.1.2.tgz
npm http GET https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-1.2.4.tgz
npm http 304 https://registry.npmjs.org/mime-db
npm http 304 https://registry.npmjs.org/parseqs/0.0.2
npm http 304 https://registry.npmjs.org/component-inherit/0.0.3
npm http GET https://registry.npmjs.org/parseqs/-/parseqs-0.0.2.tgz
npm http 304 https://registry.npmjs.org/ws/1.0.1
npm http 304 https://registry.npmjs.org/has-cors/1.1.0
npm http GET https://registry.npmjs.org/component-inherit/-/component-inherit-0.0.3.tgz
npm http 304 https://registry.npmjs.org/yeast/0.1.2
npm http 304 https://registry.npmjs.org/xmlhttprequest-ssl/1.5.1
npm http 200 https://registry.npmjs.org/component-emitter/-/component-emitter-1.1.2.tgz
npm http 200 https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-1.2.4.tgz
npm http GET https://registry.npmjs.org/has-cors/-/has-cors-1.1.0.tgz
npm http GET https://registry.npmjs.org/ws/-/ws-1.0.1.tgz
npm http GET https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.5.1.tgz
npm http GET https://registry.npmjs.org/yeast/-/yeast-0.1.2.tgz
npm http 200 https://registry.npmjs.org/parseqs/-/parseqs-0.0.2.tgz
npm http 200 https://registry.npmjs.org/component-inherit/-/component-inherit-0.0.3.tgz
npm http 200 https://registry.npmjs.org/yeast/-/yeast-0.1.2.tgz
npm http 200 https://registry.npmjs.org/has-cors/-/has-cors-1.1.0.tgz
npm http 200 https://registry.npmjs.org/ws/-/ws-1.0.1.tgz
npm http 200 https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.5.1.tgz
npm http 304 https://registry.npmjs.org/parsejson/0.0.1
npm http GET https://registry.npmjs.org/callsite/-/callsite-1.0.0.tgz
npm http GET https://registry.npmjs.org/after/-/after-0.8.1.tgz
npm http GET https://registry.npmjs.org/arraybuffer.slice/-/arraybuffer.slice-0.0.6.tgz
npm http GET https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.2.tgz
npm http GET https://registry.npmjs.org/has-binary/-/has-binary-0.1.6.tgz
npm http GET https://registry.npmjs.org/blob/-/blob-0.0.4.tgz
npm http 200 https://registry.npmjs.org/callsite/-/callsite-1.0.0.tgz
npm http 200 https://registry.npmjs.org/arraybuffer.slice/-/arraybuffer.slice-0.0.6.tgz
npm http 200 https://registry.npmjs.org/after/-/after-0.8.1.tgz
npm http 200 https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.2.tgz
npm http 200 https://registry.npmjs.org/has-binary/-/has-binary-0.1.6.tgz
npm http 200 https://registry.npmjs.org/blob/-/blob-0.0.4.tgz
socket.io#1.4.8 node_modules\socket.io
├── has-binary#0.1.7 (isarray#0.0.1)
├── debug#2.2.0 (ms#0.7.1)
├── socket.io-parser#2.2.6 (isarray#0.0.1, component-emitter#1.1.2, json3#3.3.2, benchmark#1.0.0)
├── engine.io#1.6.11 (base64id#0.1.0, ws#1.1.0, engine.io-parser#1.2.4, accepts#1.1.4)
├── socket.io-adapter#0.4.0 (socket.io-parser#2.2.2)
└── socket.io-client#1.4.8 (component-emitter#1.2.0, to-array#0.1.4, indexof#0.0.1, component-bind#1.0.0, backo2#1.0.2, object-component#0.0.3, parseuri#0.0.4, engine.io-client#1.6.11)
C:\chatapplication>node app.js
C:\chatapplication\app.js:45
});
^
SyntaxError: Unexpected token )
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:901:3
C:\chatapplication>
Any ideas how I can resolve this issue, cause I don't seem to have any syntax errors in my opinion tbh :/
Thanks so much in advance.
app.get structure is:
app.get(path, callback [, callback ...])
Correct code is:
app.get('/', function(req, res){
//And then we declare the "http response" and . "sendfile" because, we are going to create a file called "index.html" that we want the client to get whenever it goes to "localhost:3000".
//Then create the "directory name" + the "index.html" web page.
res.sendfile(__dirname + '/index.html');
});
More about express routing here.
you have an additional closing bracket here
app.get('/'), function(req, res){
I have a file server.js in which I am starting multiple servers.
eg.
var engine = require('engine.io');
var server = engine.listen(80);
And if the engineio module is not installed in the current directory by using the
npm install engine.io
It throws an error
Error: Cannot find module 'engine.io'
Now on a machine where this server has to be deployed I want handle all these npm module installation dependencies from the script file itself.
How can i do this from my server.js file only
UPDATE
As suggested i tried following the post
Can I install a NPM package from javascript running in Node.js?
but it throws an error when it searches for a node module "npm"
at :
var npm = require("npm");
Reason : i dont have the node modules installed on my machine. ( and so its not having node_modules folder in my working directory)
Also,
I created a batch file in my working directory and put the following into it
npm install engine.io
npm install eyes
And when i run it,
It only installs the first module and then exits
Thanks
I'm getting the following error when trying to open Scripted 0.3 from Springsource
Error showing url: The specified location is not supported
I'm using Kubuntu 12.10 64 bits and installed it using npm (sudo npm install -g scripted) with the following output:
npm http GET https://registry.npmjs.org/scripted
npm http 304 https://registry.npmjs.org/scripted
npm http GET https://registry.npmjs.org/amdefine/0.0.2
npm http GET https://registry.npmjs.org/enhanced-resolve/0.4.5
npm http GET https://registry.npmjs.org/express/2.5.11
npm http GET https://registry.npmjs.org/formidable/1.0.9
npm http GET https://registry.npmjs.org/htmlparser/1.7.6
npm http GET https://registry.npmjs.org/json5/0.1.0
npm http GET https://registry.npmjs.org/node-static/0.5.9
npm http GET https://registry.npmjs.org/sockjs/0.3.1
npm http GET https://registry.npmjs.org/when/1.6.1
npm http GET https://github.com/kdvolder/websocket-multiplex/archive/master.tar.gz
npm http 304 https://registry.npmjs.org/enhanced-resolve/0.4.5
npm http 304 https://registry.npmjs.org/htmlparser/1.7.6
npm http 304 https://registry.npmjs.org/json5/0.1.0
npm http 304 https://registry.npmjs.org/node-static/0.5.9
npm WARN node-static#0.5.9 dependencies field should be hash of <name>:<version-range> pairs
npm http 304 https://registry.npmjs.org/sockjs/0.3.1
npm http 304 https://registry.npmjs.org/express/2.5.11
npm http 304 https://registry.npmjs.org/amdefine/0.0.2
npm http 304 https://registry.npmjs.org/formidable/1.0.9
npm http 304 https://registry.npmjs.org/when/1.6.1
npm http 200 https://github.com/kdvolder/websocket-multiplex/archive/master.tar.gz
npm http GET https://registry.npmjs.org/mime/1.2.4
npm http GET https://registry.npmjs.org/qs
npm http GET https://registry.npmjs.org/mkdirp/0.3.0
npm http GET https://registry.npmjs.org/connect
npm http GET https://registry.npmjs.org/faye-websocket/0.4.0
npm http GET https://registry.npmjs.org/rbytes/0.0.2
npm http GET https://registry.npmjs.org/node-uuid/1.3.3
npm http 304 https://registry.npmjs.org/mkdirp/0.3.0
npm http 304 https://registry.npmjs.org/mime/1.2.4
npm http 304 https://registry.npmjs.org/faye-websocket/0.4.0
npm http 304 https://registry.npmjs.org/rbytes/0.0.2
npm http 304 https://registry.npmjs.org/node-uuid/1.3.3
npm http 304 https://registry.npmjs.org/connect
npm http 304 https://registry.npmjs.org/qs
npm http GET https://registry.npmjs.org/connect/-/connect-1.9.2.tgz
> rbytes#0.0.2 install /usr/local/lib/node_modules/scripted/node_modules/sockjs/node_modules/rbytes
> node-waf configure build
Checking for program g++ or c++ : /usr/bin/g++
Checking for program cpp : /usr/bin/cpp
Checking for program ar : /usr/bin/ar
Checking for program ranlib : /usr/bin/ranlib
Checking for g++ : ok
Checking for node path : not found
Checking for node prefix : ok /usr
'configure' finished successfully (0.104s)
Waf: Entering directory `/usr/local/lib/node_modules/scripted/node_modules/sockjs/node_modules/rbytes/build'
[1/2] cxx: src/binding.cc -> build/Release/src/binding_1.o
npm http 200 https://registry.npmjs.org/connect/-/connect-1.9.2.tgz
[2/2] cxx_link: build/Release/src/binding_1.o -> build/Release/binding.node
Waf: Leaving directory `/usr/local/lib/node_modules/scripted/node_modules/sockjs/node_modules/rbytes/build'
'build' finished successfully (0.959s)
/usr/local/bin/scr -> /usr/local/lib/node_modules/scripted/bin/scr
/usr/local/bin/scripted -> /usr/local/lib/node_modules/scripted/bin/scripted
scripted#0.3.0 /usr/local/lib/node_modules/scripted
├── amdefine#0.0.2
├── node-static#0.5.9
├── when#1.6.1
├── websocket-multiplex#0.1.0
├── enhanced-resolve#0.4.5
├── json5#0.1.0
├── formidable#1.0.9
├── htmlparser#1.7.6
├── sockjs#0.3.1 (node-uuid#1.3.3 faye-websocket#0.4.0 rbytes#0.0.2)
└── express#2.5.11
I can't find any log files at the moment, is there any way to fix this?
I'm working with Mac OS X 10.7.5 and I'm using Grunt to concate some js files and minify them. Now I want to also minify my css files. As grunt does not provide any functionality I wanted to install a grunt plugin for that.
According to the instructions i have to cd into my projects root folder and install the plugin with npm. So I did the following:
cd <PROJECT_ROOT>
npm install grunt-contrib-css
The instructions for the plugin are here: https://npmjs.org/package/grunt-contrib-mincss
The I opened my grunt.js file and added
grunt.loadNpmTasks('grunt-contrib-mincss');
But when I try to run grunt I just get
Local Npm module "grunt-contrib-mincss" not found. Is it installed?
<WARN> Task "mincss" not found. Use --force to continue. </WARN>
The installation works without any problem and npm ls does list the module.
Any ideas what I have done wrong? Many Thanks!
UPDATED
When I cd into a project like so
cd ~/Sites/path/to/project
and then install the plugin
sudo npm install grunt-contrib-mincss
the module is actually installed in
~/node_modules/grunt-contrib-mincss
I could hard copy the files into my projects root directory (which works) but it's kind of strange isn't it?
UPDATE 2
I've updated node and tried it again. Below is the console output.
me:~ Fritz$ node -v
v0.8.10
me:~ Fritz$ npm -v
1.1.62
me:~ Fritz$ mkdir ./Sites/npm-test
me:~ Fritz$ cd ./Sites/npm-test/
me:npm-test Fritz$ sudo npm install grunt-contrib-mincss
Password:
npm http GET https://registry.npmjs.org/grunt-contrib-mincss
npm http 304 https://registry.npmjs.org/grunt-contrib-mincss
npm http GET https://registry.npmjs.org/gzip-js
npm http GET https://registry.npmjs.org/clean-css
npm http GET https://registry.npmjs.org/grunt-contrib-lib
npm http 304 https://registry.npmjs.org/gzip-js
npm http 304 https://registry.npmjs.org/clean-css
npm http 304 https://registry.npmjs.org/grunt-contrib-lib
npm http GET https://registry.npmjs.org/crc32
npm http GET https://registry.npmjs.org/deflate-js
npm http GET https://registry.npmjs.org/optimist
npm http 304 https://registry.npmjs.org/deflate-js
npm http 304 https://registry.npmjs.org/crc32
npm http 304 https://registry.npmjs.org/optimist
npm http GET https://registry.npmjs.org/wordwrap
npm http 304 https://registry.npmjs.org/wordwrap
grunt-contrib-mincss#0.3.0 ../../node_modules/grunt-contrib-mincss
├── grunt-contrib-lib#0.3.0
├── gzip-js#0.3.1 (crc32#0.2.2, deflate-js#0.2.2)
└── clean-css#0.4.2 (optimist#0.3.4)
Why is the plugin installed outside? Or is there a way to define the actual location where it is installed?
I had a similar issue on Ubuntu 12.04 for the module grunt-jasmine-task (same error message as above). This solved the issue for me:
Manually create the folder node_modules in the root of the project.
Run npm install grunt-jasmine-task again.
This way to install worked for me:
cd <PROJECT_ROOT>.
Run npm install grunt-contrib-mincss.
Created test file in the current dir with the following testing content:
module.exports = function(grunt) {
grunt.initConfig({
mincss: {
compress: {
files: {
"path/to/output.css": ["path/to/input_one.css", "path/to/input_two.css"]
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-mincss');
grunt.registerTask('default', 'mincss');
};
My directory structure looks like this at this moment (please check this, if some files are not there or in some other folder, then it can be reason why it doesn't work):
<PROJECT_ROOT> /
node_modules /
grunt-contrib-mincss/
grunt.js
Run grunt in terminal.
Script worked.
Possible reasons why it didn't work in your case:
You installed plugin globally (with -g argument).
You installed it in some subfolder (grunt.js and node_modules must be in the same folder).
Please check it.
I have seen cases where not having a package.json file present caused the modules to be installed globally. I'm not sure what version was running at the time, as it was not my machine.
Next time try running npm init prior to installing modules. After that, install using npm install grunt-contrib-css --save to have it added to your package.json file. You can also use --save-dev to have it added to your devDependencies.
In my case, I forgot to add:
grunt.loadNpmTasks('grunt-jsdoc-plugin');
to grunt.js, so it should look like this:
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
jsdoc : {
dist : {
src: ['frontend/js/**/*.js'],
dest: 'docs/frontend'
}
}
});
grunt.loadNpmTasks('grunt-jsdoc-plugin');
};
If you take a look under the grunt-contrib-mincss folder, there is a readme file, they changed name from grunt-contrib-mincss to grunt-contrib-cssmin.
anyway, it's not your(and mine) fault. XD