• 初次使用nodejs的问题


    使用npm install -g 'xxx' 之后仍然报 
    Cannot find module 'xxx' 错误,可以通过设置环境变量来解决; 

    Java代码  收藏代码
    1. export NODE_PATH=/usr/local/lib/node_modules/  
    2. echo $NODE_PATH  
    使用socket.io出现问题,按照demo使用<script src='http://localhost:2013/socket.io/socket.io.js'></script>出现错误:
    "io is not defined" 
    将上述代码修改为:
    <script src='socket.io/socket.io.js'></script>即可解决该问题。
    如果将上述的src直接使用本机的socket.io的地址或者cdn的公开socket.io会出现
    info  - unhandled socket.io url.依旧不能使用
     
    NPM安装模块出错
    npm http GET https://registry.npmjs.org/supervisor
     
    npm ERR! Error: failed to fetch from registry: supervisor
    npm ERR!     at /usr/share/npm/lib/utils/npm-registry-client/get.js:139:12
    npm ERR!     at cb (/usr/share/npm/lib/utils/npm-registry-client/request.js:31:9)
    npm ERR!     at Request._callback (/usr/share/npm/lib/utils/npm-registry-client/request.js:136:18)
    npm ERR!     at Request.callback (/usr/lib/nodejs/request/main.js:119:22)
    npm ERR!     at Request.<anonymous> (/usr/lib/nodejs/request/main.js:212:58)
    npm ERR!     at Request.emit (events.js:88:20)
    npm ERR!     at ClientRequest.<anonymous> (/usr/lib/nodejs/request/main.js:209:10)
    npm ERR!     at ClientRequest.emit (events.js:67:17)
    npm ERR!     at ClientRequest.onError (/usr/lib/nodejs/request/tunnel.js:164:21)
    npm ERR!     at ClientRequest.g (events.js:156:14)
    npm ERR! You may report this log at:
    npm ERR!     <http://bugs.debian.org/npm>
    npm ERR! or use
    npm ERR!     reportbug --attach /home/jon/npm-debug.log npm
    npm ERR! 
    npm ERR! System Linux 3.2.0-23-generic
    npm ERR! command "node" "/usr/bin/npm" "install" "supervisor" "-g"
    npm ERR! cwd /home/jon
    npm ERR! node -v v0.6.12
    npm ERR! npm -v 1.1.4
    npm ERR! message failed to fetch from registry: supervisor
    npm ERR! 
    npm ERR! Additional logging details can be found in:
    npm ERR!     /home/jon/npm-debug.log
    npm not ok
     
     
     
    解决方法:
    Java代码  收藏代码
    1. npm config set registry http://registry.npmjs.org/  
  • 相关阅读:
    python字符串格式化 %操作符 {}操作符---总结
    Python中TKinter模块中的Label组件
    Python中urlopen()介绍
    Python中else语句块(和if、while、for、try搭配使用)
    Python文件操作汇总
    python socket 编程之三:长连接、短连接以及心跳
    python 源代码分析之调试设置
    python 调用shell或windows命令
    python socket 编程之二:tcp三次握手
    python socket 编程之一:编写socket的基本步骤
  • 原文地址:https://www.cnblogs.com/xiaoerhei/p/4081358.html
Copyright © 2020-2023  润新知