javascript - 无法运行 Node app.js 文件

标签 javascript node.js bash

我正在学习 node.js,我正在尝试使用命令 node app.js 运行 app.js 文件,但 bash 什么也不返回(也没有错误)。以下是我遵循的步骤:

$ brew install node

$ sudo npm install -g express

$ sudo npm install -g express-generator

进入我创建的新文件夹后,我运行

$ express testsite --hogan -c less

$ cd testsite && npm install

终于

$ node app.js//不返回任何错误,但除了新的命令行之外什么也不返回...

在这方面的任何帮助都会很棒。

谢谢!

最佳答案

testsite 目录尝试 npm start

查看 package.json

scripts : { start : node bin/www }

所以你必须执行bin目录下的www

所以 node app.js 使用 node bin/www

关于javascript - 无法运行 Node app.js 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23178363/

相关文章:

无法识别 JavaScript 函数

javascript - 放置一个 div 作为 :after of another

node.js - 在嵌套对象数组中过滤 geo_point

javascript - 创建一个对象 i 一个基于字符串值数组的对象

Javascript(node.js)限制了子进程的数量

linux - 按文本查找行并从该行删除到 bash 中的其他行

bash - 将 bash stdout/stderr 重定向到两个地方?

javascript - 图表下方的对齐标签

javascript - Gulp JS Build 无法按预期工作

bash 突破读取内部陷阱