NPM not installing node module - node.js

I have an angular project that comes with a package.json file and all the dependencies listed within, but each time I run "npm install", in the terminal, the packages appear to be downloading properly and a node module folder is created in my root folder, but at a certain stage the installation stops without an error message and the generated node module folder disappear from my project. please what do I do?

I can't reproduce your situation, somehow this may not fitable for you.
But I suggest re-install node.js to make sure npm install work correctly.
This link will help to find what version of node.js for you, based on you angular version.
Compatibility list for Angular/Angular-CLI and Node.js
Also, It would be good to manage node.js via NVM(Node Version Manager).

Related

Bootstrap don't create node moduel folder via npm

I'm a beginner. I'm studying bootstrap, but when i'm trying install bootstrap via nodejs, the terminal annouced to me installing was successed, but node js don't create the node moduel folder in my project, so where is the node moduel folder? And how to create the node moduel in my project??
My english english!, i'm so sorry because of that
anyone can help me pls!
enter image description here
I would suggest creating a package.json file to keep track of the dependencies that you install.
even after running npm install bootstrap it shows a warning to create the package.json file. and bunch of other warnings about peer dependencies needed for the bootstrap such as jquery.
One of the reason that your node_module is missing might be the version of the NodeJS that you are using.
Other one can be running out of resources to needed to complete the installation such as RAM. there is something similar here.

Node-sass build issue with Docker

I am working in Docker to containerize the Angular 5 application. This app uses node-sass 4.7.2. The application works fine in the Windows environment. During "npm install", it downloads the node-sass or builds the same using the sass-library-path defined in .npmrc file.
But, there are a lot of issues during the docker image creation process. It automatically tries to download binding.node file from https://github.com/sass/node-sass/releases/download/v4.7.2/linux-x64-72_binding.node
But, there is no release for linux-x64-72. So, it downloads a dummy file(sized about 4KB) and throws "invalid ELF header" error.
If I specify some valid URL in sass-binary-path(https://github.com/sass/node-sass/releases/download/v4.7.2/linux-x64-59_binding.node), it throws "no module found" error.
I tried with npm rebuild node-sass as well. I saw a lot of answers from the internet as well. Many of the answers suggested me to copy node-modules from the local environment. You know, this is never an option with Docker. I can't ask developers to commit node-modules also in the repository.
Is there any way to resolve this issue? or Is there any simple solution to solve it in the angular application like not using node-sass?
There was a node sass version specified in the package.json. For the corresponding node-sass version, there is no library available for the os linux-x64-72_binding.node.
So, I upgraded the node-sass version in the package.json for which the Linux library was available.
Then, it downloaded the file without any issues.

Installing and Using Node JS in My Project

Im very very new in NodeJS
I want to ask about installing and using it in my Project..
I've installed nodejs in my Windows, but I have no idea how to make it works in my Cordova/Phonegap Project. I want to install this module in my project node-gcm. it said I just have to execute npm install node-gcm --save but I dont know where should I execute that command so I tried executed it on my project root (/www). After that I tried the example application code to use it but It said that require is not defined. Can anyone tell me how to fix this?
You need to learn nodejs properly to use in your project. I would recommend the below site could be a good starting point for you which covers all the basics.
http://www.tutorialspoint.com/nodejs/
You are getting that error because, when you look at the package.json file of the node-gcm package, you will notice the dependencies mentioned as,
If you are a windows user, you need to get into your node_modules directory by giving cd node_modules command in your command line and then just issue this command npm install which will install all the required packages.
Hope this helps!.

Can't build my web application when integrating bootstrap template

I'm totally new to Node.js meteor and all development outside of visual studio.
When I go in the console and add bootstrap like this :
npm install twitter-bootstrap
It gets installed and adds all the bootstrap files in my solution but when I run my application with meteor it says
Process finished with exit code 254
No more information. No errors. If I delete all the bootstrap files, it builds and run just fine. Any idea what might be causing this?
I've tried looking for the exit code meaning but I can't find it for my IDE and I'm a bit clueless as for why simply adding those packages without even referencing them anywhere in the project might cause my application not to run at all.
You can't add npm packages in your project folder like that. It will create a node_modules sub-directory that meteor will treat like any other project folder, i.e., it will interpret all the files in it. That's not what you want. Either do the npm install in a super-directory, or, better yet, use the meteor meteorhacks:npm package (https://atmospherejs.com/meteorhacks/npm):
meteor add meteorhacks:npm
and then add the npm dependency to your packages.json file.
{
"twitter-bootstrap": "2.1.1"
}
But the real question is: why do you need this package? bootstrap3 is already part of the standard meteor packages, i.e., you already have full access to bootstrap, incl. javascript.
You can use atmosphere meteor packages called mizzao:bootstrap-3 by running the commend
meteor add mizzoa:bootstrap-3
Alternatively if you want to use npm packages you must add meteorhacks:npm packages.
meteor add meteorhacks:npm
npm install twitter-bootstrap
You can specify all the required npm packages inside a packages.json file.
{
"gm":"1.16.0",
"twitter":"0.2.12",
"twitter-bootstrap":"2.1.1",
}

Meteor 0.9.0 bundle and deploy throw errors

I upgraded to Meteor 0.9.0 today. I use meteor bundle filename to bundle my application and upload to AWS. When I try to start it on AWS, I get
wrong ELF class: ELFCLASS32
This is a known problem with fibers/bcrypt, so I used to go to bundle/programs/server/node_modules, remove the fibers and bcrypt folders and reinstalling them (npm install).
However, currently the node_modules directory does not exist anymore... When I am trying to start nodejs I get
Error: Cannot find module 'underscore'
I tried to manually add the modules with npm install, and even got the server to eventually run, but the client didn't load and the console error was about
Spacebars undefined
(I don't have the exact Spacebar issue)
I know that Meteor 0.9.0 is very new, but if you have advice I would really appreciate it!
You don't need to remove any folders, simply do this in the bundle directory (output of the untarred meteor bundle):
cd bundle
cd programs/server
npm install
Meteor 0.9.0 makes sure it puts up all the node_modules which don't contain binaries, and creates a package.json for npm install for both bcrypt and fibers
Since you've removed the npm modules in node_modules you may have to recreate the bundle from scratch to get them back.
For the Spacebars undefined issue its very likely that you have a package in your project that is not compatible with Meteor 0.9.0. You can find out which one it is by checking your server logs. Though it is not compatible, your app will still run.
This may be boostrap-3, though it may not be. If it is you can meteor remove mrt:bootstrap-3 and meteor add mizzao:bootstrap-3.
Akshat, you are a lifesaver! Based on your answer I eventually managed to figure it out! For the benefit of others, I want to document what eventually worked:
First, I had to manually remove all the old packages from my Meteor project (seems that it didn't do it automatically). In particular, I removed
iron-router
which was the pre-Meteor 0.9 version and installed
iron:router
which is the post-Meteor 0.9 version. (I had to do a similar process of removing and adding different packages for 2-3 other packages too).
Then, once I bundled and unpacked on AWS, I did what Akshat said about npm install in bundle/programs/server. In addition, I had to manually remove the original bctypt by deleting the folder
bundle/programs/server/npm/npm-bcrypt
as otherwise I got an ELS error
If you're getting this error with Meteor-Up. Updating the package should fix it.
npm update mup -g

Resources