Cannot find module 'delegates' in CRA yarn add node-sass - reactjs

I have created a fresh app with CRA and want to add Sass support according to its official description which simply says to add it with yarn add node-sass
but this throws an error
error /home/.../frontend/node_modules/node-sass: Command failed.
Exit code: 1
Command: node scripts/install.js
Arguments:
Directory: /home/.../frontend/node_modules/node-sass
Output:
module.js:550
throw err;
^
Error: Cannot find module 'delegates'
at Function.Module._resolveFilename (module.js:548:15)
at Function.Module._load (module.js:475:25)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/home/amir/WORKSPACE/daypay/daypay_v2/frontend/node_modules/are-we-there-yet/tracker-stream.js:4:16)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)

I dont know why but it seems node_modules where messed up though it was a new created app.
SO I hard coded the node-sass and #types/node-sass in package.json deleted the yarn.lock or (package-lock) and node_modules folder and run yarn install again

Related

react project ,im getting this error,i have try to delete the node module and package.json but i got permission not granted to delete,also npm install

node:internal/modules/cjs/loader:956
const err = new Error(message);
^
Error: Cannot find module './functions/valid'
Require stack:
C:\Users\paul\AppData\Roaming\npm\node_modules\npm\node_modules\semver\index.js
C:\Users\paul\AppData\Roaming\npm\node_modules\npm\lib\cli.js
C:\Users\paul\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:956:15)
at Function.Module._load (node:internal/modules/cjs/loader:804:27)
at Module.require (node:internal/modules/cjs/loader:1028:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object. (C:\Users\paul\AppData\Roaming\npm\node_modules\npm\node_modules\semver\index.js:12:10)
at Module._compile (node:internal/modules/cjs/loader:1126:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
at Module.load (node:internal/modules/cjs/loader:1004:32)
at Function.Module._load (node:internal/modules/cjs/loader:839:12)
at Module.require (node:internal/modules/cjs/loader:1028:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\Users\paul\AppData\Roaming\npm\node_modules\npm\node_modules\semver\index.js',
'C:\Users\paul\AppData\Roaming\npm\node_modules\npm\lib\
Please follow the steps below:
Delete the node_modules directory
Delete the package-lock.json file
Run npm cache clean --force
Run npm install
Run npm start

After ejecting app with Yarn doesn’t start anymore

I'm new to React Native and want to do some tutorials. But after I eject the project through:
yarn eject
I get this error in the terminal:
yarn run v1.13.0
$ react-native run-ios
internal/modules/cjs/loader.js:582
throw err;
^
Error: Cannot find module '#babel/runtime/helpers/interopRequireDefault'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)
at Function.Module._load (internal/modules/cjs/loader.js:506:25)
at Module.require (internal/modules/cjs/loader.js:636:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (/Users/joppemeijers/Documents/react/cashierr/node_modules/react-native/local-cli/cliEntry.js:11:41)
at Module._compile (internal/modules/cjs/loader.js:688:30)
at Module._compile (/Users/joppemeijers/Documents/react/cashierr/node_modules/pirates/lib/index.js:99:24)
at Module._extensions..js (internal/modules/cjs/loader.js:699:10)
at Object.newLoader [as .js] (/Users/joppemeijers/Documents/react/cashierr/node_modules/pirates/lib/index.js:104:7)
at Module.load (internal/modules/cjs/loader.js:598:32)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
This is a whole new project and I didn't add anything. I searched on Google for some solutions but can't get it fixed, maybe some of you guys can help me?
Is there something I don’t have installed?

npm test/ jest not working

I am trying to run a test with react/jest. When I do npm test /jest, I am getting the following error:
> # test /Users/suparnasoman/Downloads/create-react-app-master
> node packages/react-scripts/scripts/test.js --env=jsdom
module.js:471
throw err;
^
Error: Cannot find module 'jest'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/Users/suparnasoman/Downloads/create-react-app-master/packages/react-scripts/scripts/test.js:26:14)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
npm ERR! Test failed. See above for more details.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
Check if the npm package is installed successfully.
If the installation is successful check if it is installed globally/locally.
If local, you might need to provide the absolute path node_modules/bin/jest
It seems the jest module is missing, did you try npm --save install jest, or npm install as Chase mentioned?

Getting an error when using babel to convert react jsx code

I am trying to convert my jsx code to js using babel.
babel --presets es2015,react --minified finan.js -o ./compiled/compiled.js
Error: Cannot find module 'js-tokens'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object. (C:\Users\Saurav\Desktop\newcode dev\untitled4\node_modules\babel-preset-es2015\node_modules\babel-plugin-transform-es2015-function-name\node_modules\babel-hel
per-function-name\node_modules\babel-traverse\node_modules\babel-code-frame\lib\index.js:50:41)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
Recently i faced the same error . Just use :
npm update
or delete babel-preset-es2015 from node_modules folder and reinstall it using
npm install

Cannot find module 'require-dir' error while running gulp app:serve rails

I installed npm, bower and gulp. But while running gulp app:serve, I am getting the following error.
Please help me.
This is the command I run:
sachin#sachin:~/Desktop/workspace/myproj/angular/ex (master)$gulp app:serve
Result I got:
Error: Cannot find module 'require-dir'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/home/sachin/Desktop/workspace/myproj/angular/ex/gulpfile.js:14:1)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
Error: Cannot find module 'require-dir'
You've installed gulp but have not installed its tasks' dependencies. E.g. if a gulp task has any require('') calls, then it depends on require-dir. Those dependencies are probably in your project's package.json file. To install all the dependencies run:
npm install

Resources