cannot find module './framer' after deleting node modules - node.js

I was cleaning up the angular code and, deleted some unused custom modules. After which, It was throwing an error about a deleted imported component in app.module.ts even though it was already removed from import.
Then, I manually deleted the node modules, ran npm install and tried to run npm start which gives me the following error:
Cannot find module './framer'
Error: Cannot find module './framer'
at Function.Module._resolveFilename
(internal/modules/cjs/loader.js:581:15)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (C:\Users\NBS627\eclipse-workspace\ccmobile-
UI\node_modules\spdy-transport\lib\spdy-transport\protocol\base\index.js:7:18)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (C:\Users\NBS627\eclipse-workspace\ccmobile-
UI\node_modules\spdy-transport\lib\spdy-transport.js:10:27)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
I have no idea about this error. Please help.

Your error says that you have a problem with your spdy-transport module.
To solve this you must update your spdy-transport module:
npm un spdy-transport
Then:
npm i spdy-transport

One of the packages which you deleted might have a dependency on an existing module
for example, when we do npm install package-name, often more than one folder are created in the node_modules folder, we may think that it is not required but it is in fact needed

Related

node js express not able to resolve node modules/merge-descriptors

I have a simple node.js express application.
When I run npm run serve, I am getting below error.
In my node_modules folders I can see merge-descriptors folder, but when I try to start express server, looks like it is complaining about not able to find the component.
My path correctly has node_modules/.bin set.
internal/modules/cjs/loader.js:583
throw err;
^
Error: Cannot find module 'merge-descriptors'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object. (/tmp/site/node_modules/express/lib/express.js:16:13)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)

Throw error whenever attempting to use geoproject command in terminal

I keep getting the same error anytime I try to use the geoproject command.
I have the latest version of node and D3 downloaded.
error message:
Parkers-MacBook-Pro-2:proj parkerbarton$ geoproject
internal/modules/cjs/loader.js:583
throw err;
^
Error: Cannot find module 'resolve'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (/usr/local/lib/node_modules/d3-geo-projection/bin/resolve.js:2:15)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
tldr; Just re-install to get the new version of d3-geo-projection.
npm install -g d3-geo-projection
There's an issue for this here: https://github.com/d3/d3-geo-projection/issues/161
And there's a fix for this up on a pull request, but it hasn't gotten pulled in yet. You could wait for the fix or in the meantime you can probably just add 'require' into the same place in {global-install-location}/node_modules/d3-geo-projection/package.json
https://github.com/d3/d3-geo-projection/pull/162/commits/43105df62b784f0645cb3d4cb0b0fa98c8924c87
UPDATE: It's up on 2.6, just re-install d3-geo-projection.

ng serve : Cannot find module './templates.js'

I just transfered my Angular 6 project from one computer to another and in the new device I get the following error when trying to ng serve
I have also tried with npm install templates.js , the dependency is installed but this error pops again
Cannot find module './templates.js'
Error: Cannot find module './templates.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:603:15)
at Function.Module._load (internal/modules/cjs/loader.js:529:25)
at Module.require (internal/modules/cjs/loader.js:658:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (C:\Users\Godwin\Desktop\livigro\node_modules\chalk\index.js:6:18)
at Module._compile (internal/modules/cjs/loader.js:722:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:733:10)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
at Function.Module._load (internal/modules/cjs/loader.js:552:3)
at Module.require (internal/modules/cjs/loader.js:658:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (C:\Users\Godwin\Desktop\livigro\node_modules\postcss\lib\css-syntax-error.js:9:14)
at Module._compile (internal/modules/cjs/loader.js:722:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:733:10)
at Module.load (internal/modules/cjs/loader.js:620:32)
This could be similar to ng serve: Cannot find module 'tapable'
Thanks in Advance :)
Removing the node_modules folder and again using npm install solves the problem , and the ng serve working good
It can occur for two reasons:
1. templates.js is not present.
2. templates.js is present but you provided the wrong relative path.
Kindly check once. And you don't need to install "templates.js" if it's not an external package. Npm install is used for installing the external packages.

gulp dev cant be run because of mistake

I run npm install in the project's root and then when I try to run gulp de, I get the following mistake:
$ gulp dev
module.js:442
throw err;
^
Error: Cannot find module './lib/public/public-utils'
at Function.Module._resolveFilename (module.js:440:15)
at Function.Module._load (module.js:388:25)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\ente\node_modules\browser-sync\index.js:9:21)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\ente\gulpfile.js:27:21)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Liftoff.handleArguments (C:\Users\Man\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js:116:3)
at Liftoff.<anonymous> (C:\Users\Man\AppData\Roaming\npm\node_modules\gulp\node_modules\liftoff\index.js :193:16)
at module.exports (C:\Users\Man\AppData\Roaming\npm\node_modules\gulp\node_modules\flagged- respawn\index.js:17:3)
at Liftoff.<anonymous> (C:\Users\Man\AppData\Roaming\npm\node_modules\gulp\node_modules\liftoff\index.js:185:9)
at C:\Users\Man\AppData\Roaming\npm\node_modules\gulp\node_modules\liftoff\index.js: 159:9
at C:\Users\Man\AppData\Roaming\npm\node_modules\gulp\node_modules\v8flags\index.js:108:14
at C:\Users\Man\AppData\Roaming\npm\node_modules\gulp\node_modules\v8flags\index.js:36:12
at C:\Users\Man\AppData\Roaming\npm\node_modules\gulp\node_modules\v8flags\index.js:47:7
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
at Module.runMain (module.js:577:11)
at run (bootstrap_node.js:352:7)
at startup (bootstrap_node.js:144:9)
at bootstrap_node.js:467:3
the gulp file
i tried different things, like to go to an older node, to the latest one, reinstalled node, npm and gulp billions of times, but it didnt help.
What can it be and how to fix it?
The error seems to happen when you require the browser-sync module in your gulpfile. The module doesn't find one of it's own components ./lib/public/public-utils and can't start.
I'd first check in your node_modules directory to see what's going on with browser-sync.
It's usually a corrupted install of the module.
Make sure that in your package.json you have browser-sync listed with the most up-to-date version (2.13.0) and to get a fresh install delete your node_modules directory, npm cache clean
and run npm install again.

Error: Cannot find module './is-buffer'

I haven't found any posts that have an answer for this one. It appears to be a sourcing issue, but no matter what I try I can't seem to source it properly. I get the following error when trying to launch my application.
is-buffer is installed. I see it in my node-modules directory.
C:\MY-APP\dataService>node dataAPI.js
module.js:338
throw err;
^
Error: Cannot find module './is-buffer'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (C:\MY-APP\node_modules\socket.io\node_modules\so
ket.io-adapter\node_modules\socket.io-parser\index.js:11:13)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
I tried setting this in my binary file as well as my package.json. I'm able to change it in my binary file, but no matter what I'm not able to find the correct src dir.
I also tried npm install is-buffer -g to no avail. Any advice?
Unexpected token ILLEGAL
I was able to update the source to
var isBuf = require('C:\VF_PDO_APP\node_modules\is-buffer');
So now it seems to be going to the right place I think. Now however, I'm getting Unexpected token ILLEGAL.
C:\MY-APP\dataService>node dataAPI.js
C:\MY-APP\node_modules\socket.io\node_modules\socket.io-adapter\node_modules\socket.io-parser\binary.js:10
socket.io\node_modules\socket.io-adapter\node_modules\socket.io-parser
^^^
SyntaxError: Unexpected token ILLEGAL
at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (C:\MY-APP\node_modules\socket.io\node_modules\soc
ket.io-adapter\node_modules\socket.io-parser\index.js:10:14)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
You first must install all your project dependencies, do it on the root folder of your project:
npm install
For your problem with socket.io try to:
npm install socket.io --save
For the bson problem:
npm install bson --save
(for this one probably you will need to install python and c++)

Resources