意外的字符串错误需要在JS App文件中找不到Express

Jng*_*297 2 node.js coffeescript express

我有一个用快递,节点,套接字io和coffeescript编写的js web应用程序.我想在本地计算机上启动本地服务器.

我去了包含该package.json文件的目录并运行npm install以安装包括express的所有依赖项.

当我跑步时,npm list我确实看到了express那里.

当我尝试启动应用程序时

node app.coffee的所在目录内app.coffee位于

它给了我这个错误

exports, require, module, __filename, __dirname) { express = require 'express'
                                                                     ^^^^^^^^^
SyntaxError: Unexpected string
    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
Run Code Online (Sandbox Code Playgroud)

我确保我有节点

which node 我在我的机器上安装了咖啡脚本

sudo npm install -g coffee-script

我甚至试过了

coffee app.coffee

我不确定还需要检查什么.该app.coffee是我的文件夹的NodeJS.

Nia*_*son 5

简单地跑

coffee app.coffee -n
Run Code Online (Sandbox Code Playgroud)

你可以在这里找到更多信息