nodejs安装遇到问题
来源:3-27 基于nodejs实现websocket代理场景配置演示
llllllllx
2020-01-18
先说明:nodejs完全不懂-.-!!
3-27节,我是yum install nodejs,yum install npm,然后在/opt/nodejs目录下,执行
npm install ws
npm install wscat
输出如下:
[root@master nodejs]# npm install ws
/opt/nodejs
├── UNMET PEER DEPENDENCY bufferutil@^4.0.1
├── UNMET PEER DEPENDENCY utf-8-validate@^5.0.2
└── ws@7.2.1
npm WARN enoent ENOENT: no such file or directory, open '/opt/nodejs/package.json’
npm WARN ws@7.2.1 requires a peer of bufferutil@^4.0.1 but none was installed.
npm WARN ws@7.2.1 requires a peer of utf-8-validate@^5.0.2 but none was installed.
npm WARN nodejs No description
npm WARN nodejs No repository field.
npm WARN nodejs No README data
npm WARN nodejs No license field.
[root@master nodejs]# npm install wscat
/opt/nodejs
└─┬ wscat@4.0.0
├── UNMET PEER DEPENDENCY bufferutil@^4.0.1
├── commander@4.1.0
├─┬ https-proxy-agent@3.0.1
│ ├─┬ agent-base@4.3.0
│ │ └─┬ es6-promisify@5.0.0
│ │ └── es6-promise@4.2.8
│ └─┬ debug@3.2.6
│ └── ms@2.1.2
├─┬ read@1.0.7
│ └── mute-stream@0.0.8
└── UNMET PEER DEPENDENCY utf-8-validate@^5.0.2
npm WARN enoent ENOENT: no such file or directory, open '/opt/nodejs/package.json’
npm WARN ws@7.2.1 requires a peer of bufferutil@^4.0.1 but none was installed.
npm WARN ws@7.2.1 requires a peer of utf-8-validate@^5.0.2 but none was installed.
npm WARN nodejs No description
npm WARN nodejs No repository field.
npm WARN nodejs No README data
npm WARN nodejs No license field.
[root@master nodejs]# node ./server.js
Server started
/opt/nodejs/node_modules/ws/lib/websocket.js:347
…options
^^^
SyntaxError: Unexpected token …
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:549:28)
at Object.Module._extensions…js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.require (module.js:504:17)
at require (internal/module.js:20:19)
at Object. (/opt/nodejs/node_modules/ws/index.js:3:19)
我仍然不想跳过这一节,我该怎么做…
2回答
-
Jeson
2020-01-21
升级下node的版本试试
00 -
无名点
2020-01-19
我遇到过相似的问题,是因为使用yum缺少依赖包的原因,你可以检查一下你的yum源,有可能是yum源的问题
00
相似问题