Plesk How to install additional modules? - node.js

i have troubles using Node Js with Plesk. I have a Root Server (Ubuntu + Plesk Onyx) and installed Node Js. My API runs well. But now I have a new API Build, and must install new Node modules. (Hummus.js) When I want to install it through my package.json I get =
Execution filemng has failed with exit code 1, stdout:
hummus#1.0.81 install /var/www/vhosts/XXX/api.XXX/node_modules/hummus
node-pre-gyp install --fallback-to-build
I think the problem is failed dependencies for Hummus.
So I want to do
npm install -g node-gyp
But how can I run it with plesk? I have only a "NPM Install" button but it run install package.json

Plesk locates npm for its node versions under /opt/plesk/node. Like /opt/plesk/node/6 or /opt/plesk/node/7 So to install modules you should run:
/opt/plesk/node/7/bin/npm install -g node-gyp

Related

How to install Electron from a custom mirror

I'm trying to install electron version 6.0.10 using yarn but getting "error":
read ECONNRESET" at \node_modules\electron\install.js:49.
As per the existing stackoverflow and github help, I have to install electron from a different mirror.
How to do that?
I can use npm if an npm specific solution exists.
Electron can be installed from a different mirror using electron-download npm package.
Install electron-download using npm (for me yarn didn't work for its installation).
npm install -g electron-download
Use electron-download to download the zip of electron from a custom repository.
electron-download --mirror=https://npm.taobao.org/mirrors/electron/ --version=6.0.10
//Change the version accordingly
Now, you can simply run the command in the project directory to install all packages by
yarn
Or
npm install
Or can install electron individually by
npm install electron
In all cases npm or yarn will check for the zip of electron in local workspace and install that.

How to resolve this gulp watch issue [duplicate]

I am trying to start my angular app using grunt serve command
but I am getting Fatal error: spawn cmd ENOENT.
I used following commands to generate my Angular App
npm install -g yo grunt-cli bower
npm install -g generator-angular
yo angular
npm install
bower install
then i used grunt serve command to start my app
but its not working.
System Info:
OS: Windows 7 64 bit
npm version : 2.11.3
please help me, I gone through all the grunt documentation but no clue.
Try the following possible solutions:
Verify the npm folder exists at the following location C:\Users\My-UserName\AppData\Roaming\npm
Try to run npm cache clean
Add C:\Windows\System32\ to the PATH Environment variable
Run grunt serve with cmd.exe instead of git bash. I have the same problem and have dealt with it in this way.

angular cli install command showing errors

npm install -g #angular/cli
I am trying to install angular cli on Windows 10, I have already installed npm and node, and have verified their version, they are above then what is required for angular cli to install but when I run install command on the prompt it show error.
i have uninstalled npm and node, then reinstalled them, and tried again to install and it worked :) thanks
first try to see node and npm is installed successfully using following commands on cmd
node -v
for node and it will return the version of node,then
npm -v
then it will return the version of npm after that in windows go to environment variables and see node environmental varible is there. after that
npm cache clean --force
use to clean the cache and go to users/Appdata/roaming and delete all the node modules in npm cache folder and restart your computer and give the following command.
npm install -g #angular/cli

Vue-cli generating project stopped

when I try to generate a project with vue-cli, its stopped, that is what i get
>> vue init webpack test
? Project name test
? Project description (A Vue.js project)
Then I cant cancel with ctl + c or something, I hit enter and nothing, im use node v8 and npm v5
I fixed this by first uninstalling the vue-cli by running npm uninstall vue-cli -g then uninstalling my Node.js from the control panel: Then installing the latest current version(not the LTS version) of Node.js then running npm install -g npm then install the vue-cli again using npm install -g vue-cli
In a nutshell update Node.js and npm to the latest versions then install the vue-cli.
Update: In case you use Ubuntu or any Ubuntu base OS:
First, uninstalling the vue-cli by running sudo npm uninstall vue-cli -g then uninstall your current version of Node and install the latest version from here (install the build tools as well) then run sudo npm install -g npm then install the vue-cli again using sudo npm install -g vue-cli

Using NodeJs' Grunt on code that is developed on Windows and built on Linux?

How to use nodejs to build a cross platform project?
I develop on Windows, but my codebase builds on a Linux-based CI server. It uses Grunt to build the frontend, and requires several nodejs modules for that.
Nodejs requires modules to be installed locally to the project in order for the to be loaded by grunt.task.loadNpmTasks. The issue with that is that I have to install them from somewhere, either Windows or Linux, and when I do from one it doesn't work on the other.
The list modules my project require are installed locally as follows:
npm install connect-livereload --production
npm install time-grunt --production
npm install load-grunt-tasks --production
npm install jshint-stylish --production
npm install load-grunt-tasks --production
npm install grunt-contrib-copy --production
npm install grunt-contrib-concat --production
npm install grunt-contrib-uglify --production
npm install grunt-contrib-compass --production
npm install grunt-contrib-jshint --production
npm install grunt-contrib-cssmin --production
npm install grunt-contrib-connect --production
npm install grunt-contrib-clean --production
npm install grunt-contrib-htmlmin --production
npm install grunt-contrib-imagemin --production
npm install grunt-contrib-watch --production
npm install grunt-rev --production
npm install grunt-usemin --production
npm install grunt-mocha --production
npm install grunt-exec --production
npm install grunt-open --production
npm install grunt-svgmin --production
npm install grunt-concurrent --production
npm install grunt-ember-templates --production
npm install grunt-replace --production
npm install grunt-neuter --production
If I install it from Windows and then run grunt on the project folder from Windows still it all works perfectly. If I then check the code into git and build in the linux box, chmod 777 and chown to my user, and run the same grunt command. It fails with a lot of errors like these:
Running "mocha:all" (mocha) task
Testing: http://localhost:9000/index.html
Fatal error: spawn ENOENT
I ran npm install and it starts failing with another message:
Running "mocha:all" (mocha) task
Testing: http://localhost:9000/index.html
/home/administrator/platform/frontend/node_modules/grunt-contrib-compass/node_modules/tmp/lib/tmp.js:261
throw err;
^
Error: spawn ENOENT
at errnoException (child_process.js:998:11)
at Process.ChildProcess._handle.onexit (child_process.js:789:34)
Nothing I do makes it work.
So from the Linux box I deleted the whole node_modules directory from my project and rerun the install commands above. All works perfectly on Linux now.
Then I check it into git and checkout in Windows. Then I go to the project folder and run grunt, and then it fails with:
Running "mocha:all" (mocha) task
Testing: http://localhost:9000/index.html
Running PhantomJS...ERROR
>> 'c:\Users\Edy' is not recognized as an internal or external command,
0 [ '\'c:\\Users\\Edy\' is not recognized as an internal or external command,\r',
>> 'operable program or batch file.' ]
>> operable program or batch file. 1 [ '\'c:\\Users\\Edy\' is not recognized as an internal or external command,\r',
>> 'operable program or batch file.' ]
Warning: PhantomJS exited unexpectedly with exit code 1. Use --force to continue.
Uninstalling phantomjs and installing it locally doesn't help. Installing globally doesn't help either. So the only way to make it work on Windows seems to be deleting the node_modules dir and reinstalling on Windows, which brings me to the first issues on Linux.
Is there a way to use nodejs stuff in a cross platform environment like mine? I cannot believe I'm the first one with such a setup out there hehe
Any tips or help in this is appreciated. Thanks!
Many dependencies in node.js use native addons. Native addons are compiled for your specific environment when you npm install.
If you're moving between environments, you can npm rebuild to rebuild those binaries for the new environment. Or the more lengthy way, remove the node_modules folder and npm install again.
Fatal error: spawn ENOENT means a process node.js is trying to spawn does not exist. A common case when trying to spawn a binary compiled for another environment, the binary it is expecting does not exist.

Resources