初次使用nodejs的问题

it2022-05-06  16

使用npm install -g 'xxx' 之后仍然报  Cannot find module 'xxx' 错误,可以通过设置环境变量来解决;  Java代码   export NODE_PATH=/usr/local/lib/node_modules/  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代码   npm config set registry http://registry.npmjs.org/  

转载于:https://www.cnblogs.com/xiaoerhei/p/4081358.html

相关资源:数据结构—成绩单生成器

最新回复(0)