Getting an error when using babel to convert react jsx code - reactjs

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

Related

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

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

The "#angular/compiler-cli" package was not properly installed. Error: Cannot find module '#angular/compiler-cli'

When trying npm start or ng serve it shows the error like this :
The "#angular/compiler-cli" package was not properly installed. Error: Error: Cannot find module '#angular/compiler-cli'
Error: The "#angular/compiler-cli" package was not properly installed. Error: Error: Cannot find module '#angular/compiler-cli'
at Object. (/home/jsnsree/.nvm/versions/node/v6.11.2/lib/node_modules/#angular/cli/node_modules//src/index.js:14:11)
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)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (/home/jsnsree/.nvm/versions/node/v6.11.2/lib/node_modules/#angular/cli/tasks/eject.js:10:19)
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)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
And the ng versoin in my application shows :
#angular/cli: 1.3.2
node: 6.11.2
os: linux x64
#angular/animations: error
#angular/common: error
#angular/compiler: error
#angular/core: error
#angular/forms: error
#angular/http: error
#angular/platform-browser: error
#angular/platform-browser-dynamic: error
#angular/platform-server: error
#angular/router: error
#angular/cli: error
#angular/compiler-cli: error
I tried to remove and reinstall angular/cli but it doesn't make any changes:
Try re-installing your CLI.
npm uninstall -g #angular/cli
npm cache clean
npm install -g #angular/cli#latest
delete node_modules from your project
and run
npm install
this will work
Try this command:
npm install #angular/{animations,common,compiler,compiler-cli,core,forms,http,platform-browser,platform-browser-dynamic,platform-server,router}

Mean Stack application module.js:471 throw err; ^

Getting Following error message,I tried to fix by updating npm and reinstall of mean stack application by running npm install
Error: Cannot find module 'npm'
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>
(C:\Users\Laptop2\AppData\Roaming\npm\node_modules\mean-cli\lib\cli.js:5:7)
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)
Update Npm by using following command issue resolve
npm install npm#latest -g
Try:
npm install npm#latest -g

Error during installation of nodejs

$ yo --version && bower --version && grunt --version
When i run this command I got the error shown below :
1.6.0
1.7.7
grunt-cli v0.1.13
module.js:341
throw err;
^
Error: Cannot find module './schema/safe'
at Function.Module._resolveFilename (module.js:339:15)
at Function.Module._load (module.js:290:25)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object.<anonymous> (C:\Users\IBM_ADMIN\node_modules\grunt\node_modules\js-yaml\lib\js-yaml\loader.js:8:22)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
How to resolve this issue?

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