您的位置:首页 > Web前端 > Node.js

安装node.js可能出现的问题及解决方法

2017-03-16 15:46 716 查看
我在安装node.js时遇到很多问题,在网上搜索了很久,才找到这些靠谱的解决办法,现在收集整理一下,以备日后使用。

1.运行node.js出现 “socket: (10107)系统调用失败”



原因:     winsock出错解决方法:    以管理员身份打开cmd,使用以下命令 netsh winsock reset重启电脑即可。
以管理员分身打开cmd:在C:\Windows\System32路径下找到cmd。

右击cmd,点击以管理员的身份运行,可以看到一个以管理员身份运的cmd程序。


参考网站:http://loli.la/2016/09/28/e8-bf-90-e8-a1-8c-node-js-e5-87-ba-e7-8e-b0-socket-10107-e7-b3-bb-e7-bb-9f-e8-b0-83-e7-94-a8-e5-a4-b1-e8-b4-a5-e3-80-82-e9-94-99-e8-af-af/ http://jingyan.baidu.com/article/e73e26c0f87c2424adb6a7f1.html
2.执行grunt -v:Reading "???" Gruntfile...ERRORA valid Gruntfile could not be found. Please see the getting started guide formore information on how to configure grunt: http://gruntjs.com/getting-startedFatal error: Unable to find Gruntfile.
注意:grunt命令时安装grunt-cli模块时产生的,如果只是安装grunt模块是不会有grunt命令的。 写Gruntfile配置文件,在当前目录下新建一个文件,命名为Gruntfile.js,内容如下。//包装函数module.exports = function(grunt) {    //任务配置    grunt.initConfig({        'hello-world':{}    });    //自定义任务    grunt.registerTask('hello-world', 'My "asyncfoo" task.', function() {        grunt.log.writeln('hello world');    });    grunt.registerTask('default', ['hello-world']);};然后再当前目录执行下grunt命令,输出如下:C:\模拟磁盘\projects\grunt\grunt-helloworld>gruntRunning "hello-world" taskhello world Done, without errors. 这里自定义一个输出hello world的模块,然后让grunt框架使用它。 参考网站:http://blog.csdn.net/larrywangsun/article/details/27428093
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐