Problem when running sass after installation - node.js

THE PROBLEM
I'm trying to run sass as part of a course I'm doing. However, when inputting the following command:
PS H:\Qubo\LEARNING\HTML & CSS\CSS\sass_sandbox> npm run sass
I get this:
> node-sass -w scss/ -o dist/css/ --recursive
'CSS\CSS\sass_sandbox\node_modules\.bin\' is not recognized as an internal or external command,
operable program or batch file.
internal/modules/cjs/loader.js:883
throw err;
^
Error: Cannot find module 'H:\Qubo\LEARNING\node-sass\bin\node-sass'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
at Function.Module._load (internal/modules/cjs/loader.js:725:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sass_sandbox#1.0.0 sass: `node-sass -w scss/ -o dist/css/ --recursive`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sass_sandbox#1.0.0 sass script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\My Name\AppData\Roaming\npm-cache\_logs\2020-11-08T20_44_40_258Z-debug.log```

I found a solution to my problem, albeit I don't exactly know how it works.
SOLUTION:
Looking at the code, I noticed that it had a problem finding a folder, which was not in the folder is what looking for.
It was looking in 'C' when my folder was in H (a separate hard drive).
I moved it to the desktop (inside 'C') and presto, it worked.

Related

NPM ERROR, NEXT.JS ERROR can not use npm run dev

> # dev C:\Users\Mustafa\Desktop\React&Next\insta-2.0
> next dev
'Next\insta-2.0\node_modules\.bin\' is not recognized as an internal or external command,
operable program or batch file.
internal/modules/cjs/loader.js:905
throw err;
^
Error: Cannot find module 'C:\Users\Mustafa\Desktop\next\dist\bin\next'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
at Function.Module._load (internal/modules/cjs/loader.js:746:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # dev: `next dev`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Mustafa\AppData\Roaming\npm-cache\_logs\2021-10-13T15_27_45_466Z-debug.log
I am using npm run dev and it gives me this error and I don't understand what this error is about if any of you could help me solve this I would really appreciate it
Go to the root directory of Your next project and run this commands in terminal:
npm install next react react-dom
after
npm run dev
Or if You are using VSCode open Your next project in Visual Studio Code, run the integrated terminal (Ctrl+`) and enter the above commands.
It's should works now ;-)

Not able to start react application - ENOENT: no such file or directory, but its NOT package.json file(The file is present)

I am new to react and I was following the official documentation in order to create my first react app - https://reactjs.org/docs/create-a-new-react-app.html
The commands are simple, I have read many post in many forums but I didn't see someone having this problem.
So I installed node.js with version 14.18.0 LTS which is OK as per the documentation in react (Node >= 14.0.0 and npm >= 5.6). Then I ran the 3 commands again from the documentation:
npx create-react-app my-app
cd my-app
npm start
First two commands are executed successfully, but when I run npm start it fails with the following error:
$ npm start
> my-app#0.1.0 start F:\Programming\my_location\my-app
> react-scripts start
internal/fs/utils.js:259
throw err;
^
Error: ENOENT: no such file or directory, lstat 'C:\Users\streetzaki96\AppData\Local\Temp;F:'
at Object.realpathSync (fs.js:1646:7)
at Object.<anonymous> (F:\Programming\my_location\my-app\node_modules\temp-dir\index.js:9:13)
at Module._compile (internal/modules/cjs/loader.js:1185:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1205:10)
at Module.load (internal/modules/cjs/loader.js:1034:32)
at Function.Module._load (internal/modules/cjs/loader.js:923:14)
at Module.require (internal/modules/cjs/loader.js:1074:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (F:\Programming\my_location\my-app\node_modules\tempy\index.js:5:17)
at Module._compile (internal/modules/cjs/loader.js:1185:30) {
errno: -4058,
syscall: 'lstat',
code: 'ENOENT',
path: 'C:\\Users\\streetzaki96\\AppData\\Local\\Temp;F:'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-app#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my-app#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\streetzaki96\AppData\Roaming\npm-cache\_logs\2021-10-05T21_31_51_222Z-debug.log
The machine which I am trying to run the code is with Windows 8.1 Pro. I also tried running the same commands on another machine which is with Windows 10 and I don't get any error there.
I tried running npm with verbose npm start --verbose to see if I can see something in the log file, but it is the same error message just with more lines of code.

I get these errors when I use the ```npm run dev``` command

Error: Cannot find module 'This is the Folder path \bin\webpack.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:889:15)
at Function.Module._load (internal/modules/cjs/loader.js:745:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
at internal/main/run_main_module.js:17:47* {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # dev: `webpack serve --config ./bundler/webpack.dev.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\21697\AppData\Roaming\npm-cache\_logs\2021-09-20T20_54_58_070Z-debug.log
PS C:This is the Folder path>
PS: I did delete both the package-lock & node_modules and reinstalled npm using npm install
but the problem still exists, I also tried reinstalling node js, same thing
Error: Cannot find module 'This is the Folder path \bin\webpack.js'
It's looking for a module with name/path 'This is the Folder path \bin\webpack.js'. That doesn't look like a valid module name/path.
Looks like you added some debug text somewhere you shouldn't have.
Hard to come up with other explanations since you did not post any of the code.
I finally solved it by reinstalling both node js & npm and instlalling chokidar 3 using the command npm i chokidar#3.0.0 it turns out that the previous version does not support node js 14+

Unable to start project after create-react-app: Error: Cannot find module 'C:\Users\pcname\Documents\react-scripts\bin\react-scripts.js'

I created a small react project using npx create-react-app to work on some react tutorials but I am unable to start the react app. This i the error that I get when trying to run the project:
> test-app#0.1.0 start C:\Users\pcname\Documents\React R&D\Pluralsight\test-app
> react-scripts start
'D\Pluralsight\test-app\node_modules\.bin\' is not recognized as an internal or external command,
operable program or batch file.
internal/modules/cjs/loader.js:983
throw err;
^
Error: Cannot find module 'C:\Users\pcname\Documents\react-scripts\bin\react-scripts.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:980:15)
at Function.Module._load (internal/modules/cjs/loader.js:862:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
at internal/main/run_main_module.js:18:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! test-app#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the test-app#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\pcnmame\AppData\Roaming\npm-cache\_logs\2020-04-08T22_43_14_881Z-debug.log
I've uninstalled node, reinstalled it. Install react-scripts globally and not globally. I've replaced the start script in the package.json to be:
"start": "node node_modules/react-scripts/scripts/start.js"
and that works. I've also run react-scripts start inside the app folder and again, that works!! But I can't get it to work when I do npm start inside the app folder
Bonus: Any tutorials setting up React in Visual Studio (not vs code) without using ASP NET Core would be appreciated. I'm currently unable to set up the debugger with VS.
This error can happen after you use create-react-app in case you have some invalid character in your path.
Remove & from your path.
Change from this:
C:\Users\pcname\Documents\React R&D\Pluralsight\test-app
To this:
C:\Users\pcname\Documents\React RD\Pluralsight\test-app
It should work now!
re-running npm i solved my problem.
I had the same problem, turns out "reinstalling" npm packages gets rid of the annoying
Error: Cannot find module 'C:\Users\pcname\Documents\react-scripts\bin\react-scripts.js'
.
.
.
{
code: 'MODULE_NOT_FOUND',
requireStack: []
}
error message.

Npm start not working after running create-react-app ONLY in Documents directory

I've been battling this issue all day and still cannot figure out what I am missing. I've always created my projects under the Documents directory on my computer but I've started getting the following error when trying to start a project after using create-react-app.
my-app#0.1.0 start C:\Users\{user}\Documents\B&R Fun\nginx_test_deploy\my-app
react-scripts start
'R' is not recognized as an internal or external command,
operable program or batch file.
internal/modules/cjs/loader.js:985
throw err;
^
Error: Cannot find module 'C:\Users\{user}\Documents\react-scripts\bin\react-scripts.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:982:15)
at Function.Module._load (internal/modules/cjs/loader.js:864:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
at internal/main/run_main_module.js:18:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-app#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my-app#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\{user}\AppData\Roaming\npm-cache\_logs\2020-03-30T21_02_14_553Z-debug.log
Interestingly, running the exact same commands on my desktop creates an app without errors. Is there some configuration I'm missing that could impact apps created under the 'Documents' folder?
You should try to clear and re-install node_modules. You can do this by running the following command.
rm -rf node_modules package-lock.json && npm install && npm start
Also, upgrade to a later version of node and npm.
Try to rename B&R Fun folder to avoid ampersand there. It seems that & breaks everything. See this issue

Resources