unable to find css in index.js - node.js

enter image description hereI have a React app with node backend
I get this error:
Failed to compile
Module not found: Can't resolve 'assets/css/bootstrap.min.css'
My index.js is as follows:
import "assets/css/bootstrap.min.css";

In case of import, you must first go to the previous directory. For this you must use "./".
Try this if the file is in the same directory: './assets/css/bootstrap.min.css'
if not, go to the correct directory using "../" instead of "./"

It's a path related issue:
make sure the path is correct (if assets in the root do something like /assetts/css ..)
make sure the file bootstrap.min.css exists
make sure you don't uppercase or lowercase some letters

Related

Failed to compile ./src/components/Chat/Chat.js Module not found: Can't resolve './components' in

Failed to compile
./src/components/Chat/Chat.js
Module not found: Can't resolve './components' in 'C:\Users\VISHAL\Desktop\Chat-app\lets_meet\client\src\components\Chat'
I am copy this project from github but it is showing error..... i didn't copy whole project just copy some of the pages...
the link of the github from where i copied the code is
can anyone help me?
Chat.js is trying to import component.js from the Chat folder which doesn't exists. Navigate to the correct path where the component.js file located.
Actually it is giving this type of error because i forgot to make a file inside message folder message.js ,Now it's working fine .I think if there is any missing file then it will give error like that .... Sorry for made a common mistake.

Cannot find module'./config'

Whenever I type node . in terminal, (I'm using Visual Studio, idk if that matters) it gives me this error:
throw err;
^
Error: Cannot find module './config'
For issues related to the terminal, try to install npm locally, it might solve the problem.
(or)
You can make the directory root of your project, as explained in this link
For issues related to compilation, you need a proper way to reference files relative to application root in Node.JS
Example: config = require('../config/config');
The folder named .. is the parent folder helps in making the path to the file, which means we can go up for two levels with this ../
When you compare (.) and (..) , (.) means current location where as .. means two levels up above the current one.
also,
Try checking ./Config with Caps instead of ./config

Importing css file in jsx using relative path

I feel a bit silly asking this, but I'm having trouble with resolving a relative path in my React app.
Where I want to import the css:
src/components/pages/mypage.js
Where my css file is located:
src/custom_styles/sidebar.css
How I'm trying to import sidebar.css in mypage.js:
import '.../custom_styles/sidebar.css'
This is resulting in Module not found: Can't resolve '.../custom_styles/sidebar.css' in the console when compiling. What am I doing wrong?
import '../../custom_styles/sidebar.css'; in your mypage.js file.
../ means that you're going one level up from your current file. In your case you have to move two ups.
import '../../../custom_styles/sidebar.css'
Each time you want o get to the parent folder add ../ so if you want to get to 3 folders above use ../../../ , not .../

Webpack "cannot find module" error, path is wrong

I am trying to publish my application and I am getting the following webpack error:
Error: Cannot find module 'C:\Users\User\source\repos\DDvwn\node_modules\webpack\bin\webpack.js'
The path it provides is wrong. The correct path to the file should be C:\Users\User\source\repos\DDvwn\DDvwn\node_modules\webpack\bin\webpack.js, with another "DDVwn" subfolder present in the hierarchy. I am not seeing a place to change this in the config file and my searches online haven't been fruitful.
Anyone know how to fix this?

Jade: "TypeError: path must be a string" with --watch, when saving .jade file

I have jade watching my directory to auto compile the templates to html files.
I've entered the following into the command line: jade --watch templates.
This returns rendered templates/index.html and compiles the .jade file just fine at first.
But when I attempt to save the .jade file again, it does not compile, and returns this error in the command line:
TypeError: path must be a string
at Object.fs.lstat (fs.js:675:11)
at renderFile (/usr/local/lib/node_modules/jade/bin/jade.js:172:6)
at StatWatcher.<anonymous> (/usr/local/lib/node_modules/jade/bin/jade.js:119:11)
Not sure what "path" it's referring to. But in case it's the directory "templates", I've tried the same command with the directory in quotes.
This is apparently only an issue with the current jade version, 1.8.2. If you lock your dependency in your package.json to the previous version (like below), this issue goes away.
{
"name": "my-app",
"dependencies": {
"jade": "1.8.1"
}
}
I've gone ahead and submitted a new github issue, so hopefully this will get resolved.
Ive run into the same problem and unfortunately ive run into a real wall on finding any documentation on this
If you want to, i found an alternative which i find adequate:
Download the code from here: http://swarminglogic.com/jotting/2014_02_watchfile
Its a simple file watcher
Alias the code or whatever your preference is.
Run watchfile test.jade jade ./ --out /tmp in the right directory. This will run a jade compilation through watchfile every time your file changes.
Workaround i know but it works... Why does people always take for granted that you bundle everything when running node services? On searches for jade html TypeError: path must be a string i only come upon Express.js threads

Resources