vendredi 27 février 2015

'require' keyword not being recognized by webstorm

I'm using WebStorm as the IDE.


Here's my folder structure and express.js insalled:


enter image description here


But my sample code is not aware of the require keyword:



var express = require('express');
var app = express();

app.listen(1337, function(){
console.log("ready");
});


Update


Per Darin's answer Here's my package.json file which now sits in the root of the Website folder:


enter image description here



{
"name": "MyTestSite.com",
"version": "0.0.1",
"description": "A Website",
"main": "test.js",
"directories": {
"test": "tests"
},
"dependencies": {
"express": "^4.11.2"
},
"devDependencies": {},
"scripts": {
"test": "n/a"
},
"repository": {
"type": "git",
"url": "https://github.com/n/a"
},
"keywords": [
"express"
],
"author": "My Name",
"license": "n/a",
"bugs": {
"url": "http://ift.tt/17FeEEr"
},
"homepage": "https://github.com/n/a"
}


This was created with npm init. I don't think I need all that crap in there so now I just have:



{
"name": "MyTestSite.com",
"version": "0.0.1",
"description": "A Website",
"main": "test.js",
"directories": {
"test": "tests"
},
"dependencies": {
"express": "^4.11.2"
}
}


I must have something malformed here...WebStorm still doesn't recognize the require keyword.


require is a keyword for npm isn't it?


Aucun commentaire:

Enregistrer un commentaire