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

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

Related

Something went wrong installing the "sharp" module

I already do what the error said. I removed the sharp then npm install --ignore-scripts=false --verbose but it still doesn't work.
I also tried the:
rimraf node_modules
rimraf yarn.lock
yarn
What might the problem here?
npm: 6.13.4
node: v10.18.0
python: 3.7.0
sharp: ^0.26.2
windows 10 pro 64-bit
! Error:
Something went wrong installing the "sharp" module
\\?\C:\Users\ph2200009\Desktop\TM\cplus_incident_mgnt\functions\node_modules\sharp\build\Release\sharp.node is not a valid Win32 application.
\\?\C:\Users\ph2200009\Desktop\TM\cplus_incident_mgnt\functions\node_modules\sharp\build\Release\sharp.node
- Remove the "node_modules/sharp" directory then run
"npm install --ignore-scripts=false --verbose" and look for errors
at Object.<anonymous> (C:\Users\ph2200009\Desktop\TM\cplus_incident_mgnt\functions\node_modules\sharp\lib\constructor.js:34:9)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (C:\Users\ph2200009\Desktop\TM\cplus_incident_mgnt\functions\node_modules\sharp\lib\index.js:3:15)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (C:\Users\ph2200009\Desktop\TM\cplus_incident_mgnt\functions\helpers\image.js:1:15)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
! We were unable to load your functions code. (see above)
If you have an Apple M1 chip, try the following:
brew install vips
npm rebuild --verbose sharp
I used this rebuild command to fix it:
npm rebuild --verbose sharp
Try to remove the node_modules folder by typing rm -rf node_modules in terminal and then type npm i and after that try to install sharp again by npm i sharp

Cannot find module 'true-case-path'

I am not able to run npm start am getting the below error
E:\angular2\projects2018\angularFlex>npm install
> node-sass#4.7.2 install E:\angular2\projects2018\angularFlex\node_modules\node-sass
> node scripts/install.js
module.js:471
throw err;
^
Error: Cannot find module 'true-case-path'
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> (E:\angular2\projects2018\angularFlex\node_modules\node-sass\lib\extensions.js:11:22)
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)
You might want to update your nodejs & npm, i just installed 9.4.0 (npm 5.4.2) and its fixed!

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?

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}

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

Resources