How to use npm-check [duplicate] - javascript

This question already has answers here:
webpack is not recognized as a internal or external command,operable program or batch file
(25 answers)
Closed 5 years ago.
I have been playing around with node.js and learning by playing with the Spotify API.
Spotify provided example source code which I have been building off but now I want to make my own thing.
There are many modules in node_module for use for their different examples and I obviously don't want any packages I am not using being hosted on my Git so I looking into my options and came across npm-check (https://www.npmjs.com/package/npm-check)
I did
npm install npm-check
and it was successful
I then try to run the npm-check command in the folder my app.js is contained in like so
npm-check
I then get an error saying it is not a recognized command.
what am I missing?

npm install only installs the npm module into the directory you are currently in., After running that command, you should see a node_modules directory with the npm-check module and all of it's dependencies.
To run npm check here, you would need to run /path/to/.bin/npm-check
If you would like to be able to run npm-check from any directory by simply running npm-check, you must first install it globally:
npm install -g npm-check

Related

Issues changing npm registry [duplicate]

This question already has answers here:
Override registry for installed packages in package-lock.json
(4 answers)
Closed 4 months ago.
I have a Vue 2.7 project with vuetify installed. First, I install dependencies using a custom local npm registry, which is a proxy to npm default, now the project is growing and I'm using git actions to deploy for a development server, or at least I'm trying to.
When GitHub actions try to npm install it uses package-lock.json with my registry configured, and of course can't find it, if I delete my package-lock.json or set package-lock to false before install, it returns a lot of warns and error since packages dependencies are outdated.(this happens even when I use specific versions on package.json)
My questions are.
How can I update the npm registry for all my package-lock.json tree of dependencies in order to maintain the right version for every one of them?
Is there any other solution?
See my answer on a related question:
Find/replace registry in package-lock
Delete node_modules
Verify npm install works

Nodemon not reexecuting the chages that i have made locally [duplicate]

This question already has answers here:
How to restart a node.js server
(9 answers)
Closed 3 years ago.
I created a sample node function like hello world. After being executed using the command line node myfirst.js, hello world displayed in the browser. After installing the nodemon it re-execute on small changes, but some times it became stuck and failed to recompile on major changes which needs to restarted. Do i have to install any other npm packages?
Use nodemon
Nodemon is a tool that helps develop node.js based applications by automatically restarting the node application when file changes in the directory are detected.
Install it with npm install nodemon -g
Execute your app with:
nodemon myfirst.js
Instead of using node myfirst.js
The solution will refresh every time you save your edited code.
I'm not sure I fully get what you need but you could try to use nodemon --> https://www.npmjs.com/package/nodemon
Hope it helps!

What is the step-by-step procedure for installing any npm module with Aurelia CLI?

I wanted to install jquery and found instructions here:
http://aurelia.io/hub.html#/doc/article/aurelia/framework/latest/contact-manager-tutorial/4
I then wanted to install "moment.js" and found instructions here ( I am not using typescript) :
How to import Moment-Timezone with Aurelia/Typescript
To install both of these with the Aurelia CLI the procedure is to install the respective npm module and then to manually modify aurelia.json in some way so the app recognizes it.
In the case of moments the instructions then say to place an import at the top of app.js , but this is not the case for JQuery.
First off , is there any way the changes to aurelia.json can be automated ( like a regular node.js package.json) so I don't need to manually do it and second, how do I know what modifications I am expected to make to aurelia.json ( or app.js or any other file) for the module I want to install?
With a basic node.js app its pretty simple , just npm install. With Aurelia its much more confusing.
Edit: There is also JSPM which I've read is used for front end libraries like the ones I mentioned above. However, the links with instructions for installation that I posted are not using JSPM.
Edit
I found some of the answers here:
http://aurelia.io/hub.html#/doc/article/aurelia/framework/latest/the-aurelia-cli/6
The CLI is still under development. I think the automatic adding of a package might some day be included in the CLI itself, for example with an install command.
The extra registration is required to register the package correctly for usage with RequireJS (http://requirejs.org/). And if the plugin exists of more than just 1 file, this registration is a bit more complex then just adding the name of the plugin.
There is an experimental CLI task here https://github.com/martonsagi/aurelia-cli-pacman that will do the automation for you.
Which can be installed by running:
npm install aurelia-cli-pacman -D
The above will install the package manager and register/ include itself in the tasks in your current project (be sure to run it with install, because npm won't run the post install script if you run it the i shorthand). Next, you can run the following command to install an extension:
npm i aurelia-interactjs -S
au pacman i aurelia-interactjs
The only downside for many might be that currently there aren't that many registry entries, but I think the author of the package would be very happy if you help him out by creating a pull to extend the registry. Would take you some time to figure out what would be the correct install/ import settings, but you will help out someone else and make them happy when they hit the same problem you experience :-).
JSPM has a same sort of issue around this, only is more matured/ the registry is bigger and/ or authors added specific information for JSPM installations to their package.json. For example: To install the above plugin with JSPM it will use the following highlighted section https://github.com/eriklieben/aurelia-interactjs/blob/master/package.json#L72,L86. The same is currently not possible with aurelia-cli, because the installation is done by NPM instead of through JSPM that redirects it to NPM.
If the author of the plugin didn't specify the JSPM section in the package.json, you would most likely and up with the same sort of issues. JSPM has a similar registry (https://github.com/jspm/registry/tree/master/package-overrides/npm) as aurelia-cli-pacman.

how to run the express js(node js) in command line - linux [duplicate]

This question already has answers here:
How to run Node.js as a background process and never die?
(14 answers)
Closed 6 years ago.
I had installed the node js, express js and npm to manage my application.
i have created the app using express js. Now I want to the run my express js app in command line in linux. currently i'm using DEBUG=alpha-webtorrent:* npm start to run my app.
I also want to run my app in background for forever.
In your command line run npm install -g pm2 cd o your app,lication and run pm2 start app.js viola your server will run forever and restart if a crash occurs. Documentation for pm2 is here
install a package called forever
npm install forever -g
Go through the documentation to know more about it.
https://www.npmjs.com/package/forever
And then use
forever start filename.js

How to run node.js applications locally for development

I am new to node.js,today I joined in another team they are working with node.js,backbone.js,marionette.js and sqlserver.I have an idea about backbone,Marionette but I never work on node.js.They asked me to clone the git repository,As per their suggestion I installed node.js.
After cloning the repository,I got the files just in the following way.
I opened node_modules folder,It has nearly 10 sub-folders are there.
node-sqlserver doesn't have any files inside.might be because of that I am getting the following error while server running time.
I ran the server with the following command
node server.js local
getting the following error
I don't know,why I am getting.can anyone help me.
Thanks.
You need to install all the dependent modules through npm install, In your case, you need to install node-sqlserver.
npm install node-sqlserver
Generally your source code will be having a package.json. This file specifies all the
dependent modules required to run the application, but here this file is missing.

Categories