我有Windows 7 32位.我安装了最新的Node.js 32位.当我尝试运行该命令时npm install jquery,收到错误:
错误:ENOENT,stat'C:\ Users\RT\AppData\Roaming \npm
如何解决它?
我试图在一个名为hello.js的单独文件中运行用javascript编写的hello world程序
目前正在运行node.js的windows版本.
代码在控制台窗口中运行完美,但如何在Windows环境中引用该路径.
C:\abc\zyx\hello.js
Run Code Online (Sandbox Code Playgroud)
在Unix中我猜它显示$ node hello.js
我是Node.js的新手.如果我做错了,请纠正我.
我试过了
> node C:\abc\zyx\hello.js ----没用
> C:\abc\zyx\hello.js - 不行
UPDATE1:
将node.exe添加到hello.js文件所在的文件夹中.
添加了文件夹c:\ abc\zyx \的路径点,我收到一条错误消息
ReferenceError:未定义hello
看到hello.js的内容
setTimeout(function() {
console.log('World!');
}, 2000);
console.log('Hello');
Run Code Online (Sandbox Code Playgroud)
更新2:
到目前为止,我已经尝试了所有这些版本,但它们似乎都没有用.可能是我做错了.
>node hello.js
>$ node hello.js
>node.exe hello.js
>node /hello.js
>node \hello.js
> \node \hello.js
> /node /hello.js
> C:\abc\xyz\node.exe C:\abc\xyz\hello.js
> C:\abc\xyz\node.exe C:/abc/xyz/hello.js
> hello.js
> /hello.js
> \hello.js
>node hello
Run Code Online (Sandbox Code Playgroud)
请参阅我的文件结构

已解决:请 尝试使用以下选项在命令提示符下运行,而不是运行node.exe.
c:\>node c:\abc\hello.js
Hello
World! (after 2 secs)
Run Code Online (Sandbox Code Playgroud) 在我的Windows安装PATH包括C:\Program Files\nodejs,可执行文件node.exe.我能够node从shell 启动,以及npm.我想安装新的可执行文件C:\Program Files\nodejs,但似乎无法实现.
设置NODE_PATH和NODE_MODULES变量不会改变任何东西:%appdata%\npm默认情况下仍会安装.
如何更改全局安装路径?
有什么方法可以让我的Node.js应用程序与Microsoft SQL通信?我没有在野外看到任何MS SQL驱动程序?
我将一个非常简单的应用程序放在一起,需要能够与现有的MS SQL数据库进行通信(否则我会使用mongoDB或Redis)
我是node.js的新手.我从官方网站下载并安装了node.js安装程序.我在PATH环境变量中添加了此安装程序文件夹,我可以运行程序.但是当我尝试在节点控制台中使用npm安装某个软件包时,它会显示错误npm should be run outside of the node repl, in your normal shell.我也在一个单独的控制台上试了一下.但它显示虽然我在环境变量中添加了节点但找不到命令.


当我运行npm install -g <package>它时,在我的user/AppData/Roaming/npm/npm_modules /文件夹中安装软件包.这个子文件夹不在我的PATH中,因此如果我尝试在没有显式调用整个路径的情况下运行包,则调用将失败'<package>' is not recognized as an internal or external command, operable program or batch file.
我该怎么做才能解决这个问题?
谢谢
我使用无点1.3.1.0编译较少的文件.这与bootstrap 2.x工作正常,但在切换到bootstrap 3.0.0(从这里下载源代码:http://getbootstrap.com/getting-started/)后,我突然收到此错误:
预期')'但在文件'mixins.less'第47行找到'':[46]://调整快捷方式[47]:.size(@width; @height){--------- --- ^ [48]:宽度:@width;
似乎有一个; 因为参数之间的分隔符无效.mixins.less中的原始源代码如下:
...
// Sizing shortcuts
.size(@width; @height) {
width: @width;
height: @height;
}
...
Run Code Online (Sandbox Code Playgroud)
我是否必须使用更新的更少的编译器?或者引导发布的bug少了源?
更新1:我可以看到,无点的拉取请求存在,解决了问题;
https://github.com/dotless/dotless/pulls "修复; mixin参数列表不支持#319#320"
我将继续使用css文件,直到无线点修复.
据我所知,从http://socket.io/#how-to-use,node.js会自动为服务器上的socket.io文件提供服务.
我已经安装了socket.io,npm install socket.io我可以看到它位于node_modules服务器根目录之上的一个级别.
server.js:
var static = require('./plugins/node-static');
var socketIO = require('socket.io');
var clientFiles = new static.Server('./client');
var http = require('http');
httpServer = http.createServer(function (request, response) {
request.addListener('end', function () {
clientFiles.serve(request, response);
});
}).listen(8253);
var webSocket = socketIO.listen(httpServer);
webSocket.on('connection', function(client) { .....
Run Code Online (Sandbox Code Playgroud)
index.html的:
<html>
<head>
<title>Chat</title>
</head>
<body>
<script src="/socket.io/socket.io.js"></script>
<script type="text/javascript"
src="http://code.jquery.com/jquery-1.5.2.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var webSocket = new io.Socket('localhost', { port: 8253 });
webSocket.connect(); .......
Run Code Online (Sandbox Code Playgroud)
启动服务器工作正常,但打开index.html时,我收到以下错误:
GET http://localhost:8253/socket.io/socket.io.js 404 …Run Code Online (Sandbox Code Playgroud) 我已经在本地系统上安装了node.js(路径:C:\Program Files\nodejs)。我安装了一些模块并希望将它们放置在 (C:\Program Files\nodejs\node_modules) 中。但是,安装的模块放置在 C:\Users\Administrator\AppData\Roaming\npm\node_modules 中。这是对还是错?我可以在全球范围内访问这些模块吗?
我的系统平台是windows 7,我的node版本是0.10。
我已经安装了node.js, 但是在命令提示符中未识别npm命令。 我还设置了环境变量。请帮我。
这是命令提示符下的响应:
C:\Users\593180.INDIA>npm
URIError: URI malformed
at decodeURIComponent (native)
at Url.parse (url.js:179:19)
at Object.urlParse [as parse] (url.js:101:5)
at Object.validateUrl [as validate] (C:\Program Files (x86)\nodejs\node_modu
les\npm\node_modules\nopt\lib\nopt.js:157:13)
at validate (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\nop
t\lib\nopt.js:205:24)
at validate (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\nop
t\lib\nopt.js:172:11)
at C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\nopt\lib\nopt
.js:101:12
at Array.map (native)
at C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\nopt\lib\nopt
.js:67:15
at Array.forEach (native)
C:\Program Files (x86)\nodejs\node_modules\npm\lib\npm.js:37
throw new Error('npm.load() required')
^
Error: npm.load() required
at Object.npm.config.get (C:\Program Files (x86)\nodejs\node_modules\npm\lib
\npm.js:37:11)
at exit (C:\Program Files (x86)\nodejs\node_modules\npm\lib\utils\error-hand
ler.js:49:27)
at process.errorHandler …Run Code Online (Sandbox Code Playgroud) 所以,我有一个奇怪的问题,我甚至不确定我能识别出来.我刚刚在Windows 7机器上安装了当前版本的Node.js(v.10.*).我试图在全局安装一些软件包(gulp和yoeman),但是在安装时遇到错误,在我的C:\ Users\Michael\AppData\Roaming \npm \node_modules目录中,许多软件包文件都丢失了.显然,当我尝试全局运行命令时,它会因为没有命令而失败.它从未被创造过.
其他一些全球安装的包工作正常(bower和grunt).
让事情变得非常棘手.当我将gulp安装到本地文件夹(没有-g)时,安装工作正常,我可以通过在命令之前添加整个路径来使用gulp.显然,我可以将该路径添加到我的系统属性中,因此该命令将是全局的,但这并不能解决我的问题.为什么在全局安装时安装会产生错误,而在本地安装时则不会?
当我在本地安装gulp时观察目录,我看到正在创建的文件.然后出现第一个错误,删除了许多文件.
我相信我的gulp安装日志的相关部分是:
6949 verbose lock lodash.noop@2.4.1 C:\Users\Michael\AppData\Roaming\npm-cache\7e62c2bb-lodash-noop-2-4-1.lock
6950 error Error: ENOENT, lstat 'C:\Users\Michael\AppData\Roaming\npm\node_modules\gulp\node_modules\vinyl-fs\node_modules\glob-stream\node_modules\glob2base\node_modules\lodash.findindex\node_modules\lodash.createcallback\node_modules\lodash._baseisequal\node_modules\lodash._releasearray\node_modules\lodash._arraypool'
6951 error If you need help, you may report this *entire* log,
6951 error including the npm and node versions, at:
6951 error <http://github.com/npm/npm/issues>
6952 error System Windows_NT 6.1.7601
6953 error command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "gulp"
6954 error cwd c:\wamp\www\phoenix\animus\gulp
6955 error node -v v0.10.28
6956 error npm -v 1.4.9
6957 error path C:\Users\Michael\AppData\Roaming\npm\node_modules\gulp\node_modules\vinyl-fs\node_modules\glob-stream\node_modules\glob2base\node_modules\lodash.findindex\node_modules\lodash.createcallback\node_modules\lodash._baseisequal\node_modules\lodash._releasearray\node_modules\lodash._arraypool
6958 error fstream_path …Run Code Online (Sandbox Code Playgroud) node.js ×10
npm ×6
windows ×4
dotless ×1
install ×1
javascript ×1
node-mssql ×1
socket.io ×1
sql-server ×1
tedious ×1