npm script is unable to locate an existent module - node.js

I am trying to execute a ReactJS application on my Windows 10 system using npm.
On running the execution script, it is giving me a compilation error that states:
Module not found: Can't resolve '../assets_new/fonts/lato_bold.woff' in '\src\assets_new\scss'
The file lato_bold.woff does exist in the given path, yet the script isn't able to locate it.
Can someone pls let me know how could this be resolved?

From this message:
Can't resolve '../assets_new/fonts/lato_bold.woff' in '\src\assets_new\scss'
It seems that you are trying to fetch lato_bold.woff from fonts folder in assests_new but you are searching in scss folder of assests_new. Try changing it to fonts folder.

Related

Can't create a react native empty project, app.json not found

I am currently trying to get started with react native.
I set up the development environment referring to the documentation, but can't even pass the first step and create an empty project.
I am on Windows 11, Node 16.15.1, and NPM 8.12.2
I keep getting the following error when trying to init react-ative project with expo init awesomeProject
Error downloading and extracting template package: Error: npm exited with non-zero code: 1
× Something went wrong while downloading and extracting the template.
Can't read JSON file: D:\crna\awesomeProject\app.json
└─ Cause: Error: ENOENT: no such file or directory, open 'D:\crna\awesomeProject\app.json'
Does anyone has a suggestion ?
Don't really know what is the problem but i found a soluion that might help other people in the same situation as me! like said here just run in CMD instead of GitBash
Use sudo if on linux. And maybe Admin on windows.

how to fix "Error: Cannot find module '/home/container/index.js'", I've tried everything

So the host that I use for my discord bot died so I downloaded all the code and tried hosting it on my PC. But I get the following error.
Error: Cannot find module '/home/container/index.js
I've tried everything I can:
updated nodejs
reinstalled all my packages
Changed package.json
How can I fix this?
Cannot find module means you are trying to run non-existent file.
Ensure there is index.js in your working directory. If not,
Use cd to go to the directory where it is (usually it's src near the package.json)
Run node ./index.js
Many time people have just the problem of command line to run file,
as windows and linux have
different syntax to run .js file
i.e. node ./index.js for linux
and node .\index.js for windows

MongoDb can't create migration scripts

I am trying to create a migration script on an existing project with already initialized migrate-mongo. I'm using windows btw.
Here is my problem.
When I try to create a script using this command migrate-mongo create blacklist_the_beatles
I get this error.
ERROR: ENOENT: no such file or directory, lstat 'C:\Users\saadb\AppData\Roaming\npm\node_modules\migrate-mongo\samples\undefined\migration.js' Error: ENOENT: no such file or directory, lstat 'C:\Users\saadb\AppData\Roaming\npm\node_modules\migrate-mongo\samples\undefined\migration.js'
I am running the command from VS code terminal. Is this right or should I run it from somewhere else
Just add moduleSystem property in your migrate-mongo-config.js
It can be esm or commonjs, depends on which one you using. More details here - https://github.com/seppevs/migrate-mongo/blob/49e6de971bc9581ce3a2321da2180a7877aff3a6/samples/esm/migrate-mongo-config.js
Running the following code solved the problem:
npx migrate-mongo create blacklist_the_beatles
Seems very weird, buy I was able to solve the issue by manually creating "undefined" folder in the prompted path, and I also put there all files from commonjs folder.

Got error on installation of strapi. something went wrong installing the "sharp" module. How to fix it

sharp module is present in node_module folder but why it's showing error . I don't know what's the reason behind.Even I install sharp.but still getting error.If anyone know how to fix sharp module ?. In addition. when I try to install with yarn than got something else error.
C:\Users\4' is not recognized as an internal or external command,
operable program or batch file.
Error :
Could not load js config file D:\Mohsin-Work-Space\Strapi Backend Practice Session\project_strapi23\node_modules#strapi\plugin-upload\strapi-server.js:
Something went wrong installing the "sharp" module
The specified module could not be found.
\?\D:\Mohsin-Work-Space\Strapi Backend Practice Session\project_strapi23\node_modules#strapi\plugin-upload\node_modules\sharp\build\Release\sharp-win32-x64.node
I also run into this problem during my installation, and how I managed to fix it was to run the installation command as administrator and everything worked.

add.import() adding some contents with my path

I recently started on ember JS.
I am trying to import bootstrap.css file from "node_modules\bootstrap\dist\css\bootstrap.css"
But when i run the server its shows error like
Error: ENOENT: no such file or directory, open 'E:\For Saving\ember\project2\new_project\tmp\simple_concat-input_base_path-JBlVqJm6.tmp\node_modules\bootstrap\dist\css\bootstrap.css'
It is adding some path with my path and giving me this error. I search a lot to solve this but i can't. And Also i installed the bower via npm and the bower_component is not getting added into my project folder.
Last thing I am not good with command Line Interface. can i run ember without terminal?
You can't app.import node modules files. It's only for bower components and vendor folder.
Reference from ember-cli documentation.

Resources