Cannot find module './parse' - npm

Am on Arch Linux distribution and i was working normally with npm but suddenly i started having this error
Error: Cannot find module './parse'
Require stack: - /usr/lib/node_modules/npm/node_modules/semver/functions/clean.js - /usr/lib/node_modules/npm/node_modules/normalize-package-data/lib/fixer.js - /usr/lib/node_modules/npm/node_modules/normalize-package-data/lib/normalize.js - /usr/lib/node_modules/npm/node_modules/read-package-json/lib/read-json.js - /usr/lib/node_modules/npm/node_modules/pacote/lib/fetcher.js - /usr/lib/node_modules/npm/node_modules/pacote/lib/index.js - /usr/lib/node_modules/npm/lib/utils/update-notifier.js - /usr/lib/node_modules/npm/lib/npm.js - /usr/lib/node_modules/npm/lib/cli.js - /usr/lib/node_modules/npm/bin/npm-cli.js at Module._resolveFilename (node:internal/modules/cjs/loader:1060:15) at Module._load (node:internal/modules/cjs/loader:905:27) at Module.require (node:internal/modules/cjs/loader:1127:19) at require (node:internal/modules/helpers:112:18) at Object.<anonymous> (/usr/lib/node_modules/npm/node_modules/semver/functions/clean.js:1:15) at Module._compile (node:internal/modules/cjs/loader:1246:14) at Module._extensions..js (node:internal/modules/cjs/loader:1300:10) at Module.load (node:internal/modules/cjs/loader:1103:32) at Module._load (node:internal/modules/cjs/loader:942:12) at Module.require (node:internal/modules/cjs/loader:1127:19)
even if i write the command npm --version i would have the same error.
I tried uninstalling node and npm and reinstalling them but still have same error ..
i updated arch also

Related

Using npm to install puppetteer gives Error: Cannot find module 'puppeteer/internal/node/install.js'

Trying to install puppeteer on Centos 7
npm i puppeteer
> puppeteer#19.4.1 postinstall /mypath/node_modules/puppeteer
> node install.js
internal/modules/cjs/loader.js:775
throw err;
^
Error: Cannot find module 'puppeteer/internal/node/install.js'
Require stack:
- /mypath/node_modules/puppeteer/install.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:772:15)
at Function.Module._load (internal/modules/cjs/loader.js:677:27)
at Module.require (internal/modules/cjs/loader.js:830:19)
at require (internal/modules/cjs/helpers.js:68:18)
at Object.<anonymous> (/mypath/node_modules/puppeteer/install.js:38:27)
at Module._compile (internal/modules/cjs/loader.js:936:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:947:10)
at Module.load (internal/modules/cjs/loader.js:790:32)
at Function.Module._load (internal/modules/cjs/loader.js:703:12)
at Function.Module.runMain (internal/modules/cjs/loader.js:999:10) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/mypath/node_modules/puppeteer/install.js'
]
}
It doesn't seem to have downloaded anything into the node_modules/ directory, which I think "npm i" should do, and all of the tutorials I have read do not ask you perform any action or download, before running the npm command.
What do I need to do, to make this install puppeteer? (with chrome)
I was getting this error because my node version was too old (version 10) but fixed it by switching to version 16.
To fix this I used nvm from the command line as follows:
nvm use 16
nvm alias default 16

Not able execute protractor conf.js command

Can you please tell me why I am getting below error while trying to run the command protractor conf.js, please find below npm, node and protractor version.
conf.js file there in the F:\Protractor directory.
------------ version details -------------------------------------------------
F:\Protractor>protractor --version
Version 5.3.2
F:\Protractor>npm -v
5.6.0
F:\Protractor>node -v
v8.11.3
----------------------- error------------------------------------------
F:\Protractor>protractor conf.js
[21:36:13] E/configParser - Error code: 105
[21:36:13] E/configParser - Error message: failed loading configuration file conf.js
[21:36:13] E/configParser - Error: Cannot find module 'F:\Protractor\conf.js'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at ConfigParser.addFileConfig (C:\Users\Lenovo\AppData\Roaming\npm\node_modules\protractor\built\configParser.js:135:26)
at Object.initFn [as init] (C:\Users\Lenovo\AppData\Roaming\npm\node_modules\protractor\built\launcher.js:93:22)
at Object.<anonymous> (C:\Users\Lenovo\AppData\Roaming\npm\node_modules\protractor\built\cli.js:225:10)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)

Error: Cannot find module 'wrappy'

When I try to restore my packages via yarn I'm receiving the following error:
npm run yarn --ignore-platform --ignore-optional
...
error C:\Users\mdepouw\source\repos\MyRepo\node_modules\node-sass: Command failed.
Exit code: 1
Command: node scripts/install.js
Arguments:
Directory: C:\Users\mdepouw\source\repos\MyRepo\node_modules\node-sass
Output:
module.js:471
throw err;
^
Error: Cannot find module 'wrappy'
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\mdepouw\source\repos\MyRepo\node_modules\inflight\inflight.js:1:76)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
When I a npm install it works fine.
Why does one work but not the other?
This usually happens when you update npm. To resolve this go to path "C:\Users[username]\AppData\Roaming" and delete "npm" and "npm-cache" folders. Then uninstall nodejs and reinstall using updated installer. This should solve your problem.

Syntax error on webdriver-manager 10.2.9

Post from issue #170:
After updating to the newest version, I get the following error on running 'webdriver-manager' command.
C:\Users\(user)\AppData\Roaming\npm\node_modules\webdriver-manager\built\lib\cli\logger.js:66
info(...msgs) {
^^^
SyntaxError: Unexpected token ...
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
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)
at Object. (C:\Users\(user)\AppData\Roaming\npm\node_modules\we
bdriver-manager\built\lib\cli\index.js:8:10)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
Why is this happening? Version 10.2.9 requires node 6 and since it did not follow semantic versioning / caused a big problem, it was unpublished from npm and 10.2.10 has been published. To read more about 10.2.10, see the changelog.
If you have encountered this issue, please remove the node_module/webdriver-manager and do a fresh npm install.
You can downgrade webdriver version to 9.0 with this command:
npm install -g webdriver-manager#9.0

Error running Gulp in Sylius

I've got a new install of Sylius that I'm working with. I just installed NPM and Gulp, and wanted to run Gulp for the first time. I'm getting an error, and have never worked with Gulp or Sylius before, so it's a little hard for me to understand:
gulp
module.js:328
throw err;
^
Error: Cannot find module 'gulp-if'
at Function.Module._resolveFilename (module.js:326:15)
at Function.Module._load (module.js:277:25)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/var/www/mysite.com/public_html/Gulpfile.js:2:14)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
This is happening on a Ubuntu system, but it also seems to be throwing the same error on my Mac, with a copy of the same Sylius install on it.
try running npm i -S gulp-if in your project. What this does is install the gulp-if package and saves it in your package.json file