0

我在 win 7 上运行并将 nodeJS 作为路径变量安装。

我在我的 laravel 项目中安装了一个 nodeJs 模块(pusher),并在添加另一个库时获得了以下文件夹结构:

在此处输入图像描述

我想执行我的server.js文件:

var http = require('http');
http.createServer(function (req, res) {
    res.writeHead(200, {'Content-Type': 'text/plain'});
    res.end('Hello World\n');
}).listen(1337, "127.0.0.1");
console.log('Server running at http://127.0.0.1:1337/');

我试图导航到我的 node_modules 文件夹并执行

npm server.js

但是,我只回来了:

$ npm server.js

Usage: npm <command>

where <command> is one of:
    add-user, adduser, apihelp, author, bin, bugs, c, cache,
    completion, config, ddp, dedupe, deprecate, docs, edit,
    explore, faq, find, find-dupes, get, help, help-search,
    home, i, info, init, install, isntall, issues, la, link,
    list, ll, ln, login, ls, outdated, owner, pack, prefix,
    prune, publish, r, rb, rebuild, remove, repo, restart, rm,
    root, run-script, s, se, search, set, show, shrinkwrap,
    star, stars, start, stop, submodule, tag, test, tst, un,
    uninstall, unlink, unpublish, unstar, up, update, v,
    version, view, whoami

npm <cmd> -h     quick help on <cmd>
npm -l           display full usage info
npm faq          commonly asked questions
npm help <term>  search for help on <term>
npm help npm     involved overview

Specify configs in the ini-formatted file:
    C:\Users\User\.npmrc
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config

npm@1.3.24 c:\Program Files (x86)\nodejs\node_modules\npm

任何建议我做错了什么?

我很感激你的回答!

4

0 回答 0