In one of the project setup, I followed as given the instructions.
>sudo npm install -g gulp
>sudo npm install -g coffee-script
>sudo npm install -g webpack
>sudo npm install -g webpack-dev-server
#Install development dependencies
>npm install
To start the project ran gulp command it ran succesfully.
>./node_modules/.bin/gulp
Then ran the webpack-dev-server
>./node_modules/.bin/webpack-dev-server --content-base public/ --inline
Getting following error
module.js:341
throw err;
^
Error: Cannot find module 'http-parser-js'
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> (/home/username/.nvm/versions/node/v5.5.0/lib/node_modules/webpack-dev-server/node_modules/websocket-driver/lib/websocket/http_parser.js:3: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)
I tried removing node_modules folder install again but no luck. Let me anything I am missing.
npm i http-parser-js -g
Try above
Related
command
npx react-native init gonative
I ran this command in root terminal (parrot linux) and encountered with error.
It says cannot find module 'metro/src/shared/output/bundle'
Node version : v17.3.0
npm version: 8.3.0
npx version : 8.3.0
output
Need to install the following packages:
react-native
Ok to proceed? (y) y
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module 'metro/src/shared/output/bundle'
Require stack:
- /root/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli-plugin-metro/build/commands/bundle/buildBundle.js
- /root/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli-plugin-metro/build/commands/bundle/bundle.js
- /root/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli-plugin-metro/build/commands/bundle/index.js
- /root/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli-plugin-metro/build/commands/index.js
- /root/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli-plugin-metro/build/index.js
- /root/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli/build/commands/index.js
- /root/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli/build/index.js
- /root/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli/build/bin.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:999:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/root/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli-plugin-metro/build/commands/bundle/buildBundle.js:64:22)
at Module._compile (node:internal/modules/cjs/loader:1097:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1149:10)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:999:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/root/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli-plugin-metro/build/commands/bundle/buildBundle.js',
'/root/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli-plugin-metro/build/commands/bundle/bundle.js',
'/root/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli-plugin-metro/build/commands/bundle/index.js',
'/root/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli-plugin-metro/build/commands/index.js',
'/root/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli-plugin-metro/build/index.js',
'/root/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli/build/commands/index.js',
'/root/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli/build/index.js',
'/root/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli/build/bin.js'
]
}
Remove global react-native installer
npm uninstall -g react-native-cli #react-native-community/cli
Install metro bundler
npm install --save-dev metro metro-core
Close all terminal/shell, and then run your command again
I'm having a little problem while trying to run "Yarn start" in my ReactJS project.
The error is pasted below:
yarn run v1.22.5
$ webpack-dev-server --mode development
The CLI moved into a separate package: webpack-cli
Please install 'webpack-cli' in addition to webpack itself to use the CLI
-> When using npm: npm i -D webpack-cli
-> When using yarn: yarn add -D webpack-cli
internal/modules/cjs/loader.js:883
throw err;
^
Error: Cannot find module 'webpack-cli/bin/config-yargs'
Require stack:
- C:\3AM\web\node_modules\webpack-dev-server\bin\webpack-dev-server.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> (C:\3AM\web\node_modules\webpack-dev-server\bin\webpack-dev-server.js:65:1)
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 Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\3AM\\web\\node_modules\\webpack-dev-server\\bin\\webpack-dev-server.js'
]
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I've tried to install webpack-dev-server with npm and yarn, but it didn't solve.
In package.json change the start script to "start": "webpack serve".
When ever I try to perform npm install to build my react part in project.
it throws the error below:
*module.js:472
throw err;
^
Error: Cannot find module 'webpack/lib/removeAndDo'
at Function.Module._resolveFilename (module.js:470:15)
at Function.Module._load (module.js:418:25)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\CHUBB\Sourcecode_claimyno_svn\denuncia-claimy\src\main\webapp\js\appReact\node_modules\extract-text-webpack-plugin\ExtractedModule.js:30:42)*
What is the issue with my react part and what could be a possible solution.
You have to cleaned npm cache:
$ rm -rf node_modules/
$ npm cache clean --force
$ npm i
try it:
npm install -g #angular/cli#latest
I am new to nodejs, yeoman and having issue(Cannot find module 'spdx-license-ids') while using an angular generator. I have node, bower, grunt installed. Details below.
Error: Cannot find module 'spdx-license-ids'
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:\Users\bdas\AppData\Roaming\npm\node_modules\generator-karma\node_modules\yeoman-generator\node_modules\read-pkg-up\node_modules\read-pkg\node_modules\normalize-package-data\node_modules\validate-npm-package-license\node_modules\spdx-correct\index.js:1:80)
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
Not sure about grunt etc, but to simply install any node library, do:
apt-get install npm
from the command line, thereafter any node module should be installed with:
npm install MODULE_NAME
e.g.:
npm install spdx-license-ids
or to install it globally so node can find it anywhere on your system (not always such a briliiant idea, but anyways), use the global -g flag:
npm install -g MODULE_NAME
Those extraneous tools can trip you up sometimes - grunt, yeoman, etc
When I'm using the angular yeoman generator, I'm getting the following error:
module.js:340
throw err;
^
Error: Cannot find module './lib/pack.js'
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> (C:\Users\kra\AppData\Roaming\npm\node_modules\generator-karma\node_modules\yeoman-generator\n
ode_modules\download\node_modules\decompress\node_modules\decompress-tarbz2\node_modules\tar\tar.js:171:16)
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)
Any idea why?
npm version 1.4.28
node version 0.10.33
yeoman version 1.3.3
Try remove your generator-karma and generator-angular, run npm cache clean, and install them again
I just had a similar issue, this might not be the solution but your version of npm is out of date, try typing:
sudo npm install npm -g
As referenced On the npm website (note they use sudo in the example but it might not be necessary). after that:
npm --version
Is currently 2.1.12 so it should be higher than that.
You can then try:
npm update
to upgrade everything to the latest version (See this page).
This may solve the problem.