linux - nodjs 설치
2920 단어 Linux 설치 패키지
https://www.jianshu.com/p/f4dbe17bda2e
yum remove nodejs npm -y
curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash -
sudo yum -y install nodejs
nodejs
node -v
yarn
windows
npm install -g yarn
centos
curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
sudo yum install yarn
2. 잘못 보고 해결
1. vue / cle3 프로젝트 실행 오류 sockjs - node / info 솔 루 션
bug
vue vue-cli2.x vue-cli3.x , 、 , 。 , , :
get http://localhost:8080/sockjs-node/info?t=1462183700002 net::ERR_CONNECTION_REFUSED
[WDS] Disconnected!
get http://localhost:8080/sockjs-node/info?t=1462183700002 net::ERR_CONNECTION_REFUSED
[WDS] Disconnected!
get http://localhost:8080/sockjs-node/info?t=1462183700002 net::ERR_CONNECTION_REFUSED
[WDS] Disconnected!
...
webpack.config.js :
const path = require('path');
const resolve = dir => path.resolve(__dirname, dir);
const env = process.env.NODE_ENV;
module.exports = {
// ,
publicPath: './',
// less
css: {
loaderOptions: {
css: {},
postcss: {
plugins: [
require('postcss-px2rem')({
remUnit: 37.5
})
]
}
}
},
configureWebpack: (config) => {
//
if (env !== 'development') {
}
//
config.resolve = {
extensions: ['.js', '.vue', '.json'],
alias: {
'vue$': 'vue/dist/vue.esm.js',
'@': resolve('src'),
}
}
},
chainWebpack: config => {
//
config.resolve.alias
.set('@', resolve('src'))
.set('assets', resolve('src/assets'))
.set('static', resolve('src/static'));
},
}
,sockjs-node ? ,sockjs-node JavaScript , JavaScript API, 、 web 。 :
:sockjs-node(https://github.com/sockjs/sockjs-node)
:sockjs-clien(https://github.com/sockjs/sockjs-client)
vue-cli3.x npm run serve, sockjs-node , 。 。 ?
1.
, , :
/node_modules/sockjs-client/dist/sockjs.js
1605 :
try {
// self.xhr.send(payload); //
} catch (e) {
self.emit('finish', 0, '');
self._cleanup(false);
}
2. vue.config
vue.config.js module.xports , :
devServer: {
proxy: 'http://localhost:8080',
public: '192.168.xxx.xxx:8080' // ip
}