meanio crashed with Error: Cannot find module 'connect-multiparty' - javascript

I got the error like this while running meanio app using grunt
/home/me/project/myapp/node_modules/meanio/node_modules/q/q.js:126
throw e;
^
Error: Cannot find module 'connect-multiparty'
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 Module.module.exports (/home/me/project/myapp/packages/contrib/upload/server/routes/meanUpload.js:6:21)
at /home/me/project/myapp/node_modules/meanio/lib/mean.js:286:20
at /home/me/project/myapp/node_modules/meanio/lib/util.js:21:7
at Array.forEach (native)
at walk (/home/me/project/myapp/node_modules/meanio/lib/util.js:16:25)
at /home/me/project/myapp/node_modules/meanio/lib/util.js:23:7

The error might be because of upload package in packages/contrib/upload. In that case just reinstall using mean install command
mean install upload

Open the package.json file of the mentioned package by the error and add the missing module in the dependencies item:
"dependencies": {
"connect-multiparty": "latest",
....
},
Then, run npm install in the package's folder

Related

Javascript Eslint Error: Cannot find module 'optionator'

We've got some error and we try to install optionator but nothing happened. We're using Linux
We're trying to npm i from package.json which include this dependencies
"optionalDependencies": {
"eslint-config-<name>": "github:<username>/<repo>"
}
then we tried to run npm i optionator but still get the same error
Error: Cannot find module 'optionator'
Require stack:
- /usr/share/nodejs/eslint/lib/options.js
- /usr/share/nodejs/eslint/lib/cli.js
- /usr/share/nodejs/eslint/bin/eslint.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:885:15)
at Function.Module._load (internal/modules/cjs/loader.js:730:27)
at Module.require (internal/modules/cjs/loader.js:957:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (/usr/share/nodejs/eslint/lib/options.js:12:20)
at Module._compile (internal/modules/cjs/loader.js:1068:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
at Module.load (internal/modules/cjs/loader.js:933:32)
at Function.Module._load (internal/modules/cjs/loader.js:774:14)
at Module.require (internal/modules/cjs/loader.js:957:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/usr/share/nodejs/eslint/lib/options.js',
'/usr/share/nodejs/eslint/lib/cli.js',
'/usr/share/nodejs/eslint/bin/eslint.js'
Anyone who experienced this, please help us. Thanks
So if you have not done an npm init then that is the issue. npm init initializes the project and will add the node_modules folder to the working directory, this will set it up as a node project. Then to install a dependency just run a npm install <dependency> although I do recommend doing a --save afterwards as well as it just ensures that the package is put in your current directory
$ npm init
$ npm install optionator --save
npm-init | npm Docs
Nothing worked until when I initialized the project in a new directory and reinstalled all the dependent modules afresh.
Need to give full access to package-lock.json
If you are using linux do this
sudo eslint init

Error: Cannot find module 'serialize-javascript' after running npm start in ReactJS project, even though there it exists in directory node_modules

For some reason my npm start doesn't work anymore, cause: this occurred right after switching to some unused branch (with unrelated histories) and pushing any changes (not realizing that this branch was some outdated one), then git checkout -f "" back to the recent branch. Now it doesnt work for any of my branches due to error Error: Cannot find module 'serialize-javascript'
Full error here:
internal/modules/cjs/loader.js:883
throw err;
^
Error: Cannot find module 'serialize-javascript'
Require stack:
- /home/abdullah/ecommerce-recommend-frontend/node_modules/rollup-plugin-terser/index.js
- /home/abdullah/ecommerce-recommend-frontend/node_modules/workbox-build/build/lib/bundle.js
- /home/abdullah/ecommerce-recommend-frontend/node_modules/workbox-webpack-plugin/build/generate-sw.js
- /home/abdullah/ecommerce-recommend-frontend/node_modules/workbox-webpack-plugin/build/index.js
- /home/abdullah/ecommerce-recommend-frontend/node_modules/react-scripts/config/webpack.config.js
- /home/abdullah/ecommerce-recommend-frontend/node_modules/react-scripts/scripts/start.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
at Function.Module._load (internal/modules/cjs/loader.js:725:27)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (/home/abdullah/ecommerce-recommend-frontend/node_modules/rollup-plugin-terser/index.js:3:19)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/home/abdullah/ecommerce-recommend-frontend/node_modules/rollup-plugin-terser/index.js',
'/home/abdullah/ecommerce-recommend-frontend/node_modules/workbox-build/build/lib/bundle.js',
'/home/abdullah/ecommerce-recommend-frontend/node_modules/workbox-webpack-plugin/build/generate-sw.js',
'/home/abdullah/ecommerce-recommend-frontend/node_modules/workbox-webpack-plugin/build/index.js',
'/home/abdullah/ecommerce-recommend-frontend/node_modules/react-scripts/config/webpack.config.js',
'/home/abdullah/ecommerce-recommend-frontend/node_modules/react-scripts/scripts/start.js'
]
}
The node_modules/serialize_javascript does exist and has a settings.json file in it:
{
"spellright.language": [
"en"
],
"spellright.documentTypes": [
"markdown",
"latex",
"plaintext",
"javascript"
]
}
I have tried running npm install (with -g as well, and in the node_modules/serialize_javascript dir) with output:
up to date, audited 1725 packages in 2s
130 packages are looking for funding
run `npm fund` for details
1 critical severity vulnerability
Some issues need review, and may require choosing
a different dependency.
Run `npm audit` for details.
And npm audit:
# npm audit report
node-serialize *
Severity: critical
Code Execution through IIFE - https://npmjs.com/advisories/311
No fix available
node_modules/node-serialize
1 critical severity vulnerability
Some issues need review, and may require choosing
a different dependency.
What's weird is that even checking node -version (node -v works now after sudo get-apt update) gives a similar MODULE_NOT_FOUND error:
internal/modules/cjs/loader.js:883
throw err;
^
Error: Cannot find module '/home/abdullah/ecommerce-recommend-frontend/–v'
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: []
}
Note: This only occurred after uninstalling node, then reinstalling in wsl with sudo:
rm -rf /usr/local/lib/node_modules/npm
sudo apt-get remove npm
sudo apt install nodejs
sudo apt-get update
Any ideas? Might try to just get rid of node from windows even though I use WSL and then reinstalling everything
Nevermind, I just copied an old serialize_javascript module from a previous commit since it had more stuff than just the settings.json and ran npm install to get it working.

webpack-dev-server missing dependency 'hpack.js'

Starting a new project, I've installed the latest versions of webpack and webpack-dev-server. I've added the webpack-dev-server command to my start script in my package.json. Oddly, the dev server was working the first time I ran the project, but I then blew away my node_modules folder and reinstalled. Since reinstalling I am continually blocked by the following missing dependency error.
npm start
> webpack-dev-server
module.js:442
throw err;
^
Error: Cannot find module 'hpack.js'
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> (/Users/a6001382/analytics/analytics-q/node_modules/spdy-transport/lib/spdy-transport/protocol/http2/hpack-pool.js:5:13)
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)
spdy-transport seems to be the culprit, but I am still getting the error even after explicitly running "npm install" on spdy-transports root, and ensuring that "hpack.js" exists.
Has anyone else experienced this missing dependency?
Resolved by running npm i -g npm#latest-4. Some versions of NPM don't correctly set the "main" field of package.json if the package contains a period.

module.js:327 Error: Cannot find module 'express'

Hello I am new in a nodejs and when I run any file in command prompt like:-
C:\demoData>node demo.js
I get error li9ke this
module.js:327
throw err;
^
Error: Cannot find module 'express'
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.<anonymous> (C:\demoData\shahzad.js:1:77)
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 Function.Module.runMain (module.js:441:10)
I did R&D and get the solution
npm install express
And my Problem has solved using this. But Why I required this I have already express folder globally.this path
C:\Users\broswire\AppData\Roaming\npm\node_modules;
I want to use this node_modules, I don't want locally node_modules.
Node encourages using locally installed modules. Generally, using modules installed with npm install --global or npm install -g should be reserved for cli tools and things used systemwide. So to use express in a project, it is recommended to npm install express in that directory. It is also useful to add a package.json file to save the versions of your dependencies. Then you can just navigate to your project and run npm install and it will install the required dependencies.

Sails lift error 'Cannot find module 'express/node_modules/cookie'

I am trying to create my first sails app and I've followed the steps on the sails getting started (http://sailsjs.org/get-started). But when i try to do a sails lift, i get the following error:
(node:11291) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
module.js:442
throw err;
^
Error: Cannot find module 'express/node_modules/cookie'
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> (/Users/master/Desktop/Developer/NodeJS/HelloSails/node_modules/sails/lib/hooks/session/index.js:9:12)
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 /Users/master/Desktop/Developer/NodeJS/HelloSails/node_modules/sails/lib/app/configuration/index.js:54:28
at Function.reduce (/Users/master/Desktop/Developer/NodeJS/HelloSails/node_modules/sails/node_modules/lodash/dist/lodash.js:3735:25)
at Configuration.defaultConfig (/Users/master/Desktop/Developer/NodeJS/HelloSails/node_modules/sails/lib/app/configuration/index.js:53:18)
at Configuration.bound [as defaults] (/Users/master/Desktop/Developer/NodeJS/HelloSails/node_modules/sails/node_modules/lodash/dist/lodash.js:729:21)
I tried manually removing the 'node_modules' folder, inserting express as a dependency in my package.json and running 'npm install', but that did not work.
Im running Node v6.2.2 Sail v0.10.5 and NPM v3.10.6
What am i missing here?
update sails version to latest, it is issue of npm structure, old version use tree level dependency while new version use same level structure
sails upgrade version
It's a dependency issue with npm, this worked for me when I had the issue.
npm -g install npm#latest

Categories

Resources