How to import bootstrap.css in sails.js - node.js

What is the best way to include bootstrap.css in my sails.js project? I have installed the bootstrap npm package.
npm install bootstrap#3
I believe I am suppose to import that in assets/styles/importer.less but have yet to get it working.

It looks like you may have to use Grunt to compile the less, try running
npm install - just to make sure all the dependencies are pulled in
and then run
grunt - to build the assets
http://sailsjs.org/documentation/concepts/assets/default-tasks#?less
https://github.com/gruntjs/grunt-contrib-less
https://github.com/WebDevStudios/CLI-Cheat-Sheet/blob/master/grunt-commands.md

Related

Issue with NPM start ( React)

I have just tried to view an old application of mine using npm start but it wont load keep getting the error.
Cannot find module 'C:\Users\Team Knowhow\development\Punk-API\node_modules\react-scripts\bin\react-scripts.js.
I tried creating a new react app and NPM start works fine so have no idea what the issue is with my old react app and why NPM start does not work.
Have you installed dependencies first using npm install.
If done already, try removing node_modules folder and installing dependencies again.
Make sure you have installed all dependencies including react-scripts!
You've to ensure that all the dependencies that your application is using is mentioned in the correct manner with their correct version in your pacakage.json file. And if that looks alright then run
npm i
or
npm install
This command will download all the dependencies that are mentioned in your package.json file.

Laravel 5.5 Webpack dependency was not found

Related SO question: npm - package.json override main field (I tried to do something like this using the webpack.mix.js but it didn't work).
I have a Laravel 5.5 application with npm v5.6.0 and node v9.4.0 (I'm thinking that this maybe is an npm/node version issue, but I don't have an environment to test with older versions ATM). Everything is working fine and I'm working this app for a while now and I've installed some node modules and used bootstrap.js and app.js to require/import npm modules, but it seems there is a problem with the bootstrap-treeview; I've spent more than 2 hours to try and make webpack compile with this module with no luck; I always get that error after npm run dev:
ERROR Failed to compile with 1 errors
This dependency was not found:
bootstrap-treeview in ./resources/assets/js/bootstrap.js
I tried to use both require and import inside bootstrap.js and I have even tried an other available module webpack-bootstrap-treeview which it seems that it doesn't have bower dependency:
//import "~/node_modules/bootstrap-treeview";
//require("bootstrap-treeview");
//import "bootstrap-treeview";
//import "~/node_modules/webpack-bootstrap-treeview";
//require("webpack-bootstrap-treeview");
import "webpack-bootstrap-treeview";
bootstrap-treeview: https://www.npmjs.com/package/bootstrap-treeview
webpack-bootstrap-treeview: https://www.npmjs.com/package/webpack-bootstrap-treeview
I know I can just use laravel-mix to compile the js files directly to the app.js and I will probably do, but I want to have my modules organized and I'd like to find the culprit on this issue.
EDIT
I've also tried to delete the node_modules directory then npm install and even npm cache clear, nothing worked for the webpack to compile without that error.
Looks like there are some misnamed files. Renaming the bootstrap-treeview files in node_modules\bootstrap-treeview-2\dist to bootstrap-treeview-2 allows webpack to successfully complete. Oh, and I installed the bootstrap-treeview-2 package because bootstrap-treeview has been archived.

node project not load modules

I pulled project from git, and then ran npm install, which didn't make a mistake, and ran npm run dev after installation
remaind me npm install --save ~plugins/utils ~plugins/axios
But these two documents are my own two packaging, certainly does not need install ah, and installed all the dependencies are not.
But all dependencies can be found under node_module, and I don't know what the problem is
enter image description here
They made a change on nuxt since rc3, now you have to import '~/plugins/axios' not '~plugins/axios', do the same with components

npm use local modules

I've just installed the babel-cli module locally to my project but when I run babel test.js in the terminal it outputs that the *command babel is uknown*.
What I figured out is that npm is trying to find the module in my globally installed modules instead of my project modules, how can I fix it?
Sorry for the silly question but I'm not finding a solution.
You can either
Use the babel installed in you project - node_modules/.bin/babel test.js
Add a script in your package.json and run it via npm - npm run <script_name>. npm will use the version of babel installed in your project
When you run babel. It looks for global npm directory and can't find it there.
2 ways but one is redundant.
You can link your local path to global npm directory which is
redundant and wont work for the next project. Don't never do this.
Or install it globally. That how npm works for now.
There is a discussion on that. And here is a good article. http://www.joezimjs.com/javascript/no-more-global-npm-packages/

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",
}

Resources