Cannot find module 'E:\husky\lib\bin.js' - windows

I am using windows to bootstrap a Springboot backend using jhipster. I am running into the error below concerning Husky for git hooks.
> eims-back#0.0.0 prepare
> husky install
The system cannot find the path specified.
node:internal/modules/cjs/loader:1042
throw err;
^
Error: Cannot find module 'E:\husky\lib\bin.js'
at Module._resolveFilename (node:internal/modules/cjs/loader:1039:15)
at Module._load (node:internal/modules/cjs/loader:885:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Node.js v18.13.0
npm ERR! code 1
npm ERR! path E:\Software & Tutorials\Project source\EIMS_BE
How to I solve this?
I have searched online for that error but it seems new.

Check if this is similar to nodejs issue 3709, which includes some possible solution.
If, as commented, this is a NodeJS version, as seen here, follow the downgrade process.
JHipster is supposed to support node >=16.0.0 but maybe 18.x is too advanced.

Related

Unable to install Strapi - Cannot find module '../build/Release/sharp.node'

I'm unable to install strapi. When I run the quickstart, it gives an error about not being able to find "sharp".
I tried downgrading node - from 16.x.x to 14.18.1, and I get fewer warnings, but still threw the same error.
OS: Windows
Node: 14.18.1
NPM: 6.14.15
❯ npx create-strapi-app jeffsdata-cms --quickstart  401ms  user  
npx: installed 146 in 13.315s
Creating a quickstart project.
Creating a new Strapi application at C:\Users\user\source\repos\jeffsdata-strapi\jeffsdata-cms.
Creating files.
Dependencies installed successfully.
Your application was created at C:\Users\user\source\repos\jeffsdata-strapi\jeffsdata-cms.
Available commands in your project:
npm run develop
Start Strapi in watch mode.
npm run start
Start Strapi without watch mode.
npm run build
Build Strapi admin panel.
npm run strapi
Display all available commands.
You can start by doing:
cd C:\Users\user\source\repos\jeffsdata-strapi\jeffsdata-cms
npm run develop
> jeffsdata-cms#0.1.0 build
> strapi build "--no-optimization"
Building your admin UI with development configuration ...
√ Webpack
Compiled successfully in 34.99s
Running your Strapi application.
> jeffsdata-cms#0.1.0 develop
> strapi develop
[2021-11-26T15:48:12.185Z] debug ⛔️ Server wasn't able to start properly.
[2021-11-26T15:48:12.186Z] error Error:
Something went wrong installing the "sharp" module
Cannot find module '../build/Release/sharp.node'
Require stack:
- C:\Users\user\source\repos\jeffsdata-strapi\jeffsdata-cms\node_modules\sharp\lib\constructor.js
- C:\Users\user\source\repos\jeffsdata-strapi\jeffsdata-cms\node_modules\sharp\lib\index.js
- C:\Users\user\source\repos\jeffsdata-strapi\jeffsdata-cms\node_modules\strapi-plugin-upload\services\image-manipulation.js
- C:\Users\user\source\repos\jeffsdata-strapi\jeffsdata-cms\node_modules\strapi\lib\load\load-files.js
- C:\Users\user\source\repos\jeffsdata-strapi\jeffsdata-cms\node_modules\strapi\lib\core\load-apis.js
- C:\Users\user\source\repos\jeffsdata-strapi\jeffsdata-cms\node_modules\strapi\lib\core\load-modules.js
- C:\Users\user\source\repos\jeffsdata-strapi\jeffsdata-cms\node_modules\strapi\lib\Strapi.js
- C:\Users\user\source\repos\jeffsdata-strapi\jeffsdata-cms\node_modules\strapi\lib\index.js
- C:\Users\user\source\repos\jeffsdata-strapi\jeffsdata-cms\node_modules\strapi\lib\commands\develop.js
- C:\Users\user\source\repos\jeffsdata-strapi\jeffsdata-cms\node_modules\strapi\bin\strapi.js
- Remove the "node_modules/sharp" directory then run
"npm install --ignore-scripts=false --verbose sharp" and look for errors
- Consult the installation documentation at https://sharp.pixelplumbing.com/install
- Search for this error at https://github.com/lovell/sharp/issues
at Object.<anonymous> (C:\Users\user\source\repos\jeffsdata-strapi\jeffsdata-cms\node_modules\sharp\lib\constructor.js:32:9)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:93:18)
at Object.<anonymous> (C:\Users\user\source\repos\jeffsdata-strapi\jeffsdata-cms\node_modules\sharp\lib\index.js:3:15)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
I tried to delete the sharp folder and reinstall while on node 16, but that didn't fix this issue.
I tried to reinstall sharp on 14.18.1, but got a different error.
Downgrade node to 14.18.1 (windows: control panel, remove node, then download 14.18.1 (or whatever the most recent one, if it upgrades) from here).
Run the quickstart command npx create-strapi-app jeffsdata-cms --quickstart
Still throws the error complaining about sharp.
Delete the npm_modules/sharp folder
Reinstall sharp with npm install --ignore-scripts=false --verbose sharp.
Confirm it's working with node run develop.
This didn't fix the issue for me - now it just throws another error:
❯ node run develop  1m 34.989s  user  
internal/modules/cjs/loader.js:905
throw err;
^
Error: Cannot find module 'C:\Users\user\source\repos\jeffsdata-strapi\jeffsdata-cms\run'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
at Function.Module._load (internal/modules/cjs/loader.js:746:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
I next tried to roll back to Node 16 and use the beta...
Uninstall Node 14
Install Node 16
Install strapi beta - npm install strapi#beta -g
Create new project: strapi new jeffsdata-cms --quickstart
Now I get this error...
❯ strapi develop
 4.469s  user  
[2021-11-26T16:58:19.646Z] error The client `sqlite3` is not installed.
[2021-11-26T16:58:19.647Z] error You can install it with `$ npm install sqlite3 --save`.
So, I obviously install sqlite3 - npm install sqlite3 --save, but it doesn't change the error.
So, I try running strapi build, then strapi develop... Same error - "The client sqlite3 is not installed."

Ionic 3 Cannot find module "rxjs/operators/share"

I'm using Ionic 3 to build an mobile application and everything is working fine, but when I add #ngx-translate, I got this error and I didn't find any solution for this issues
ionic (Ionic CLI) : 3.12.0
Uncaught Error: Cannot find module "rxjs/operators/share"
at Object.<anonymous> (vendor.js:159023)
at Object.<anonymous> (core.es5.js:3855)
at __webpack_require__ (bootstrap 4cdf06f8badf4bef7b37:54)
at Object.397 (main.ts:5)
at __webpack_require__ (bootstrap 4cdf06f8badf4bef7b37:54)
at Object.392 (main.js:852)
at __webpack_require__ (bootstrap 4cdf06f8badf4bef7b37:54)
at webpackJsonpCallback (bootstrap 4cdf06f8badf4bef7b37:25)
at main.js:1
For me helps change the version of #ngx-translate/core to version: "7.2.2"
I've compare with working example of github repo of ngx-translate
https://github.com/ngx-translate/core/blob/master/examples/ionic/package.json
Change the version of #ngx-translate/core in you package.json
to "#ngx-translate/core": "7.2.2",
and run npm update
I faced the same problem just few days back. What you need to do is uninstall the current #ngx-translate/core which version 9.0.2 by running this command npm uninstall #ngx-translate/core --save this will remove the module and also update your package.json file. now install the module again and specify the version number like this npm install #ngx-translate/core#8.0.0 --save.
This is most likely caused by your rxjs version. Please update it to the latest stable version and you shouldn't see this issue anymore.

Error while starting appium

While running the appium server on windows 8 i am getting the error message as:
module.js:340 > throw err; > ^ > Error: Cannot find
module 'C:\Program Files
(x86)\Appium\node_modules\appium\lib\server\main.js' > at
Function.Module._resolveFilename (module.js:338:15) > at
Function.Module._load (module.js:280:25) > at
Function.Module.runMain (module.js:497:10) > at startup
(node.js:119:16) > at node.js:902:3 >
This could be due to improper installation.
Use the below link to download and install latest appium
https://bitbucket.org/appium/appium.app/downloads/AppiumForWindows_1_4_16_1.zip
Let me know if issue persists
You Should build the Project to get your main.js...
Go to Appium folder and invoke ./reset.sh to build your node project
Recommended:
Clone the appium project from GITHUB and build your node project like i mentioned above. So, you can update easily to the very latest update of appium

"cannot find module" when installing npm modules on windows

I am new to NodeJS. I am trying to use npm on Windows 8.
I have installed using chocolatey, cinst nodejs.install (version 0.10.17). I installed as administrator (and would prefer to run npm as a normal user).
Node itself seems to be working, I can use the REPL to run simple programs.
If I try to install something using npm, I get cannot find module:
> node npm install express
module.js:340
throw err;
^
Error: Cannot find module 'C:\Users\Klas\Documents\My Dropbox\mina egna\tech\node\webserver\npm'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:901:3
I have read the answers on Nodejs cannot find installed module on Windows? but unfortunately it is still unclear to me what I have to do.
I have tried setting NODE_PATH:
In trying to follow this answer, I have tried setting it to C:\Users\Klas\AppData\Roaming\npm\node_modules (but I had to create both the npm and the subfolder node_modules myself)
I have tried creating a folder c:\node\node_module (according to this advice, even though the installation did not even create a c:\node folder) and setting it to that.
I have tried setting it to C:\Program Files\nodejs\node_modules\npm\node_modules (which did exist after installation)
I have also tried to create a node_modules folder below the current working directory. As I understand it that is where local npm will be installed?
None of these helped. So it seems to me that setting NODE_PATH is not the solution?
Using the -g flag makes no difference (I would prefer not to use it).
I get the same error both as normal user and as administrator (I would prefer to be a normal user).
I get the same error no matter where I execute the command, except when I do it in C:\Program Files\nodejs, where I get
basedir=`dirname "$0"`
^
SyntaxError: Unexpected token ILLEGAL
at Module._compile (module.js:439:25)
Not using windows, but I'm pretty sure it's just npm install express on windows too.

Node.js: Error: Cannot find module 'stack'

I tried to install howtonode.org on my Osx
cd ~/Sites/
git clone git#github.com:creationix/howtonode.org
My context is the following:
OSx version: 10.7.4
node -v v0.6.15
When I try to run the following command
~/Sites/howtonode.org node server/server.js &
I get the following error:
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Cannot find module 'stack'
at Function._resolveFilename (module.js:332:11)
at Function._load (module.js:279:25)
at Module.require (module.js:354:17)
at require (module.js:370:17)
at Object.<anonymous> (/Users/antoniopierro/Sites/howtonode.org/server/server.js:2:13)
at Module._compile (module.js:441:26)
at Object..js (module.js:459:10)
at Module.load (module.js:348:31)
at Function._load (module.js:308:12)
at Array.0 (module.js:479:10)
[1]+ Exit 1 node server/server.js
any ideas?
Try running node ~/Sites/howtonode.org/server/server.js & or go to ~/Sites/howtonode.org/server/ and runnode server
Also, you have not installed the dependencies from package.json.
Go to ~/Sites/howtonode.org/ and type inn npm install. This will install all the dependencies in ~/Sites/howtonode.org/node_modules. You can then run the server.

Resources