English 中文(简体)
在终点站用“/”号标注
原标题:Running a nodejs file with "./" in terminal
  • 时间:2011-10-15 10:46:55
  •  标签:
  • node.js

我如何使用<代码>/foo.js而不是node foo.js从终点站接手? 操作标书,但使用<代码>。 见bash: /foo.js: Permission granted

我是乌班图的新鲜人,因此我不敢肯定,他的一位非洲顾问会是否会 t。

最佳回答

Make sure the file is executable. You can check this by doing a "ls -la":

$ ls -la foo.js
-rw-r--r-- 1 daniel daniel 0 Oct 15 21:53 foo.js

缺乏“x”意味着它不能执行。 为了便于执行,使用<代码>chmod +x:

$ chmod +x foo.js
$ ls -la foo.js
-rwxr-xr-x 1 daniel daniel 0 Oct 15 21:53 foo.js

还确保你在档案的顶端有一个“she”线。 这说明哪位翻译可以用于档案:

#!/usr/bin/env node
问题回答

暂无回答




相关问题
How to make Sequelize use singular table names

I have an model called User but Sequelize looks for the table USERS whenever I am trying to save in the DB. Does anyone know how to set Sequelize to use singular table names? Thanks.

What is Node.js? [closed]

I don t fully get what Node.js is all about. Maybe it s because I am mainly a web based business application developer. What is it and what is the use of it? My understanding so far is that: The ...

Clientside going serverside with node.js

I`ve been looking for a serverside language for some time, and python got my attention somewhat. But as I already know and love javascript, I now want learn to code on the server with js and node.js. ...

Can I use jQuery with Node.js?

Is it possible to use jQuery selectors/DOM manipulation on the server-side using Node.js?

How do I escape a string for a shell command in node?

In nodejs, the only way to execute external commands is via sys.exec(cmd). I d like to call an external command and give it data via stdin. In nodejs there does yet not appear to be a way to open a ...

热门标签