Posts

Showing posts with the label npm

Node.js on Plesk showing default Plesk page

Node.js on Plesk showing default Plesk page I've created a new site in Node.js to host on my Plesk instance and I've set everything up, but the default plesk page is still showing. I've already tried a lot of things, but I can't seem to get it to work. Node.js app: function startServer(app, port, sslPort) { http.createServer(app).listen(port, () => { console.log('Server started'); console.log(`Listening on port ${port}`); }) } startServer(app, process.env.PORT || 8080); Note: app is an Expressjs instance. The git repo has been initialised and the files are showing up. NPM install worked just fine, no problem there Branch: development Additional deploy commands: npm install npm install When I check passenger with grep -r 'mod_passenger' /var/www/vhosts/system/domain.com/conf/ It returns passenger grep -r 'mod_passenger' /var/www/vhosts/system/domain.com/conf/ /var/www/vhosts/system/domain.com/conf/httpd.conf: ...

the rules behind treeshaking with an npm module and webpack

the rules behind treeshaking with an npm module and webpack If I have an npm package that exports all its components from 1 index.js file: export * from './components/A'; export * from './components/B'; Then if I have another package that consumes this package: import {A} from 'my-package'; Will the contents of components/B be bundled even though it is never used in the consuming package? components/B Is there a way around this? 1 Answer 1 Doing this: export * from './components/A'; export * from './components/B'; Is the same as doing: export class A () ... export class B () ... If you just import {A}... you are telling webpack that what you only cares about is A. import {A}... By using named imports, webpack is capable of only bundling the content of A and not bundling B in the final output. TL;TR: Always use named exports/imports if you want to have an opt...

can't “sudo npm install serialport” on ARMv7 Raspberry pi

can't “sudo npm install serialport” on ARMv7 Raspberry pi Node version v4.0.0 npm verison v2.14.2 i've tried to installing node-pre-gyp & node-gyp, which seem to install fine. i've also tried to install a specific serialport v1.7.4 version. I've also tryed adding the unsafe--perm. All don't work when installing serialport when running sudo npm install serialport --unsafe-perm i get the following error. I think it might be because my c++ compiler is outdated and node is trying to install non compatible node-pre-gyp. I'm both not sure what problem it is and how to solve it. node-pre-gyp ERR! Tried to download(404): https://github.com/EmergingTechnologyAdvisors/node-serialport/releases/download/4.0.7/serialport-v4.0.7-node-v46-linux-arm.tar.gz node-pre-gyp ERR! Pre-built binaries not found for serialport@4.0.7 and node@4.0.0 (node-v46 ABI) (falling back to source compile with node-gyp) make: Entering directory '/home/pi/node_modules/serialport/build' ...

Unexpected end of json input in Node.js

Unexpected end of json input in Node.js I have Json data which I receive it as post data in my node.js server. But the problem is, its not able to parse the string I sent.Here is my node.js server code. res.header("Access-Control-Allow-Origin", "*"); req.on('data',function(data) { var done=false; console.log(data); var schema; schema=JSON.parse(data); } Here I get the error when I parse the json data(data). undefined:776 SyntaxError: Unexpected end of JSON input at JSON.parse (<anonymous>) at IncomingMessage.<anonymous> (/Users/as6/Documents/test/server.js:206:17) at emitOne (events.js:115:13) at IncomingMessage.emit (events.js:210:7) at IncomingMessage.Readable.read (_stream_readable.js:462:10) at flow (_stream_readable.js:833:34) at resume_ (_stream_readable.js:815:3) at _combinedTickCallback (internal/process/next_tick.js:102:11) at process._tickCallback (internal/process/next_tick.js:...

npm references in Visual Studio 2017: how to deal with “exclamation - not-istalled”

Image
npm references in Visual Studio 2017: how to deal with “exclamation - not-istalled” Situation: I have tried: 1. "VS/Solution Explorer/npm/context-right-click-menu/Restore Packages.." 2. npm install 3. npm install kind-of (concreate not installed package) nothing helps. Actually I'm not suffer from it, but feel I need to know what is going on. 1 Answer 1 npm init fix this and other asterix problems (together or without del npm_modules , npm istall ). npm init del npm_modules npm istall I do not know why we should time to time repeat npm init but this works. npm init By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.