How to solve error: Cannot find module 'json-parse-helpfulerror' - node.js

In Windows, I tried to create a new application form of this site: https://facebook.github.io/react/docs/installation.html
First, I installed Node.js v8.2.1 and when I execute npm install -g create-react-app, I get the following error:
npm ERR! code MODULE_NOT_FOUND
npm ERR! Cannot find module 'json-parse-helpfulerror'
npm-debug.log:
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Users\\mushou8\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'install',
1 verbose cli '-g',
1 verbose cli 'create-react-app' ]
2 info using npm#5.2.0
3 info using node#v6.11.2
4 verbose stack Error: Cannot find module 'json-parse-helpfulerror'
4 verbose stack at Function.Module._resolveFilename (module.js:469:15)
4 verbose stack at Function.Module._load (module.js:417:25)
4 verbose stack at Module.require (module.js:497:17)
4 verbose stack at require (internal/module.js:20:19)
4 verbose stack at Object.<anonymous> (C:\Users\mushou8\AppData\Roaming\npm\node_modules\npm\node_modules\read-package-json\read-json.js:12:16)
4 verbose stack at Module._compile (module.js:570:32)
4 verbose stack at Object.Module._extensions..js (module.js:579:10)
4 verbose stack at Module.load (module.js:487:32)
4 verbose stack at tryModuleLoad (module.js:446:12)
4 verbose stack at Function.Module._load (module.js:438:3)
5 verbose cwd C:\Users\mushou8
6 verbose Windows_NT 6.1.7601
7 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\mushou8\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "create-react-app"
8 verbose node v6.11.2
9 verbose npm v5.2.0
10 error code MODULE_NOT_FOUND
11 error Cannot find module 'json-parse-helpfulerror'
12 verbose exit [ 1, true ]

In the directory folder, issue the following command:
npm update

Remove npm and reinstall it
And run:
sudo rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/npm*

Seeing what is requested in the Users folder, it seems that it should be installed as a global package.
Check and install each required package.
npm i -g json-parse-helpfulerror

You must uninstall nodejs and npm packages.
after first, you must install npm.
and you should install "npm install --save json-parse-better-errors"
Finally you can run your project
https://www.npmjs.com/package/json-parse-better-errors

I fixed it by removing the node_modules folder and reinstalling it again. To remove the folder, go to your project folder and run $ rm -rf node_modules and then reinstall your packages using your preferred package manager, either npm i or yarn install.

Related

Unable to install/ uninstall anything using npm

I'm working through a tutorial about learning npm, but am having trouble with even the simplest instructions.
Basically the first instruction given was to install the node-dev package globally, using the Terminal line: sudo npm install -g node-dev. Unfortunately, this spits out an error:
npm ERR! code MODULE_NOT_FOUND
npm ERR! Cannot find module './access-error.js'
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/samlegros/.npm/_logs/2019-02-26T00_36_39_572Z-debug.log
After some Googling and digging, nothing seemed to work for my case. So I thought I would try fully removing and reinstalling npm to start with a clean slate (I had worked with npm a while back, so maybe something messed up back then).
Even going through the official npm-removal documentation, I still get a similar error! I can't even remove npm properly...
npm ERR! code MODULE_NOT_FOUND
npm ERR! Cannot find module './access-error.js'
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/samlegros/.npm/_logs/2019-02-26T00_38_40_865Z-debug.log
Any help would be deeply appreciated. I've tried several npm tutorials over the months and they always result in errors that I just never know how to overcome, very discouraging :(
(error log, if that helps)
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'uninstall',
1 verbose cli 'npm',
1 verbose cli '-g' ]
2 info using npm#6.8.0
3 info using node#v8.11.1
4 verbose stack Error: Cannot find module './access-error.js'
4 verbose stack at Function.Module._resolveFilename (module.js:547:15)
4 verbose stack at Function.Module._load (module.js:474:25)
4 verbose stack at Module.require (module.js:596:17)
4 verbose stack at require (internal/module.js:11:18)
4 verbose stack at Object.<anonymous> (/usr/local/lib/node_modules/npm/lib/install/exists.js:4:19)
4 verbose stack at Module._compile (module.js:652:30)
4 verbose stack at Object.Module._extensions..js (module.js:663:10)
4 verbose stack at Module.load (module.js:565:32)
4 verbose stack at tryModuleLoad (module.js:505:12)
4 verbose stack at Function.Module._load (module.js:497:3)
4 verbose stack at Module.require (module.js:596:17)
4 verbose stack at require (internal/module.js:11:18)
4 verbose stack at Object.<anonymous> (/usr/local/lib/node_modules/npm/lib/install/check-permissions.js:8:14)
4 verbose stack at Module._compile (module.js:652:30)
4 verbose stack at Object.Module._extensions..js (module.js:663:10)
4 verbose stack at Module.load (module.js:565:32)
5 verbose cwd /path/to/tutorial/
6 verbose Darwin 18.2.0
7 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "uninstall" "npm" "-g"
8 verbose node v8.11.1
9 verbose npm v6.8.0
10 error code MODULE_NOT_FOUND
11 error Cannot find module './access-error.js'
12 verbose exit [ 1, true ]
I simply removed Node.js from my Mac and reinstalled it, that worked.
Command used to remove Node.js: sudo rm -rf /usr/local/{bin/{node,npm},lib/node_modules/npm,lib/node,share/man/*/node.*}
Everything works great now.

npm ERR! Cannot find module 'spdx-expression-parse'

This error occurred while command npm run watch was in process, I tried to solve it with different tactics but can't find any solution
Steps which I tried to resolve the issue
1) Remove node module, package-lock.json, yarn.lock npm cache clear and the run npm install but error still occurs.
2) Remove nodejs from control panel and reinstall with latest and then old/previous version and the reinstall but can't succeed, error still occurs.
npm ERR! code MODULE_NOT_FOUND npm ERR! Cannot find module
'spdx-expression-parse'
npm ERR! A complete log of this run can be found in: npm ERR!
C:\Users\DELL\AppData\Roaming\npm-cache_logs\2018-12-20T08_00_01_749Z-debug.log
Log File
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Users\\DELL\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'install' ]
2 info using npm#6.5.0
3 info using node#v8.12.0
4 verbose stack Error: Cannot find module 'spdx-expression-parse'
4 verbose stack at Function.Module._resolveFilename (module.js:548:15)
4 verbose stack at Function.Module._load (module.js:475:25)
4 verbose stack at Module.require (module.js:597:17)
4 verbose stack at require (internal/module.js:11:18)
4 verbose stack at Object.<anonymous> (C:\Users\DELL\AppData\Roaming\npm\node_modules\npm\node_modules\validate-npm-package-license\index.js:1:75)
4 verbose stack at Module._compile (module.js:653:30)
4 verbose stack at Object.Module._extensions..js (module.js:664:10)
4 verbose stack at Module.load (module.js:566:32)
4 verbose stack at tryModuleLoad (module.js:506:12)
4 verbose stack at Function.Module._load (module.js:498:3)
5 verbose cwd D:\it-88-lynx
6 verbose Windows_NT 10.0.17134
7 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\DELL\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install"
8 verbose node v8.12.0
9 verbose npm v6.5.0
10 error code MODULE_NOT_FOUND
11 error Cannot find module 'spdx-expression-parse'
12 verbose exit [ 1, true ]
Atlast, I have solved the problem, the spdx-expression-parse has been corrupted located in users/AppData/Roaming/npm/node_modules/
remove node_modules
uninstall nodejs
(Start Main Step)
Go to users/AppData/Roaming and delete npm and npm-cache folders manually
(End Main Step)
then run following command
rm -rf node_modules
rm package-lock.json yarn.lock
npm cache clear --force
npm install
thanks for all your suppport.

Updating npm: Cannot find module 'y18n' npm ERR?

I did not update npm for a while. My version is 5.8.0
the current is 6.4.1
I tried this command, but did not work:
$ npm install npm#latest -g
npm ERR! code MODULE_NOT_FOUND
npm ERR! Cannot find module 'y18n'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\erjan222\AppData\Roaming\npm-cache\_logs\2018-09-16T14_16_55_797Z-debug.log
Googling for similar topic on npm forum did not help -
y18-n
The debug.log file has this:
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Users\\erjan222\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'install',
1 verbose cli 'npm#latest',
1 verbose cli '-g' ]
2 info using npm#5.8.0
3 info using node#v8.10.0
4 verbose stack Error: Cannot find module 'y18n'
4 verbose stack at Function.Module._resolveFilename (module.js:547:15)
4 verbose stack at Function.Module._load (module.js:474:25)
4 verbose stack at Module.require (module.js:596:17)
4 verbose stack at require (internal/module.js:11:18)
4 verbose stack at Object.<anonymous> (C:\Users\erjan222\AppData\Roaming\npm\node_modules\npm\node_modules\cacache\lib\util\y.js:4:14)
4 verbose stack at Module._compile (module.js:652:30)
4 verbose stack at Object.Module._extensions..js (module.js:663:10)
4 verbose stack at Module.load (module.js:565:32)
4 verbose stack at tryModuleLoad (module.js:505:12)
4 verbose stack at Function.Module._load (module.js:497:3)
4 verbose stack at Module.require (module.js:596:17)
4 verbose stack at require (internal/module.js:11:18)
4 verbose stack at Object.<anonymous> (C:\Users\erjan222\AppData\Roaming\npm\node_modules\npm\node_modules\cacache\lib\entry-index.js:13:11)
4 verbose stack at Module._compile (module.js:652:30)
4 verbose stack at Object.Module._extensions..js (module.js:663:10)
4 verbose stack at Module.load (module.js:565:32)
5 verbose cwd C:\Users\erjan222\Desktop
6 verbose Windows_NT 6.1.7601
7 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\erjan222\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "npm#latest" "-g"
8 verbose node v8.10.0
9 verbose npm v5.8.0
10 error code MODULE_NOT_FOUND
11 error Cannot find module 'y18n'
12 verbose exit [ 1, true ]
I recommend that you try install y18n first then upgrade npm like this:
npm install y18n#4.0.0 -g
npm install npm#latest -g
Or install 8.12.0 LTS from nodejs
First, upgrade your npm to latest version and Then install y18n module using this commands
npm i -g npm-upgrade
npm i y18n
If you want to ignore particular module from npm update,refer this link answer.
npm install: Is there a way to ignore a particular dependency

angular cli not able to install, getting error as `Cannot find module 'hosted-git-info' `

I am trying to create new project using ng new but getting error as :
npm ERR! code MODULE_NOT_FOUND
npm ERR! Cannot find module 'hosted-git-info'
here is the detailed log file:
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Users\\MB112830\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'install',
1 verbose cli '--quiet' ]
2 info using npm#5.7.1
3 info using node#v8.9.4
4 verbose stack Error: Cannot find module 'hosted-git-info'
4 verbose stack at Function.Module._resolveFilename (module.js:538:15)
4 verbose stack at Function.Module._load (module.js:468:25)
4 verbose stack at Module.require (module.js:587:17)
4 verbose stack at require (internal/module.js:11:18)
4 verbose stack at Object.<anonymous> (C:\Users\MB112830\AppData\Roaming\npm\node_modules\npm\node_modules\normalize-package-data\lib\fixer.js:3:21)
4 verbose stack at Module._compile (module.js:643:30)
4 verbose stack at Object.Module._extensions..js (module.js:654:10)
4 verbose stack at Module.load (module.js:556:32)
4 verbose stack at tryModuleLoad (module.js:499:12)
4 verbose stack at Function.Module._load (module.js:491:3)
5 verbose cwd E:\Tutorials\Angular2\NG5\new-way
6 verbose Windows_NT 10.0.10240
7 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\MB112830\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "--quiet"
8 verbose node v8.9.4
9 verbose npm v5.7.1
10 error code MODULE_NOT_FOUND
11 error Cannot find module 'hosted-git-info'
12 verbose exit [ 1, true ]
what is the issue here? how to solve this?
It is because the files are corrupted or deleted.So follows the below steps.
1.Uninstall node.
2.Delete npm and npm-cache folder from C:\Users\userName\AppData\Roaming
3.Install node.
It works!.
Hi as i can see your project in E: drive please try to install angular in C drive globally.
npm install -g #angular/cli
after installation please create a project folder name(client) by
c://>ng new client
after creation of new project go inside client folder
C:// > cd client
c:// > client>ng serve
Open browser with localhost:4200 you can see your angular home page in running mode.
:)Cheers

npm: "Cannot find module internal/errors"

On a MacBook with the latest version of NodeJS, I am trying to update npm:
npm install npm#latest
The error message is:
npm ERR: code MODULE_NOT_FOUND
npm ERR: Cannot find module 'internal/errors'
npm ERR: A complete log of this run can be found in:
npm ERR: /Users/alexander/.npm/_logs/2017_09_15_12_35_47_079Z-debug.log
and the referenced log file reads
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'install',
1 verbose cli 'npm#latest' ]
2 info using npm#5.3.0
3 info using node#v8.5.0
4 verbose npm-session 5db7f116200ca64c
5 verbose stack Error: Cannot find module 'internal/errors'
5 verbose stack at Function.Module._resolveFilename (module.js:527:15)
5 verbose stack at Function.Module._load (module.js:476:23)
5 verbose stack at Module.require (module.js:568:17)
5 verbose stack at require (internal/module.js:11:18)
5 verbose stack at evalmachine.<anonymous>:36:16
5 verbose stack at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/cmd-shim/node_modules/graceful-fs/fs.js:11:1)
5 verbose stack at Module._compile (module.js:624:30)
5 verbose stack at Object.Module._extensions..js (module.js:635:10)
5 verbose stack at Module.load (module.js:545:32)
5 verbose stack at tryModuleLoad (module.js:508:12)
5 verbose stack at Function.Module._load (module.js:500:3)
5 verbose stack at Module.require (module.js:568:17)
5 verbose stack at require (internal/module.js:11:18)
5 verbose stack at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/cmd-shim/node_modules/graceful-fs/graceful-fs.js:3:27)
5 verbose stack at Module._compile (module.js:624:30)
5 verbose stack at Object.Module._extensions..js (module.js:635:10)
6 verbose cwd /Users/alexander/Documents/Source/Repos
7 verbose Darwin 16.7.0
8 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "npm#latest"
9 verbose node v8.5.0
10 verbose npm v5.3.0
11 error code MODULE_NOT_FOUND
12 error Cannot find module 'internal/errors'
13 verbose exit [ 1, true ]
The same worked ok on the windows machine.
What is the problem and how can I fix this?
Try to reinstall npm from the package in node v6.11.3LTS, and then
try to update to the latest npm v5.4.2
npm install npm#latest -g
and then update to the latest node v8.3.0
npm install node#latest -g
I had the same issue, the above answer did not work.
I had old versions in node_modules.
I simply deleted everything in node_modules and then ran:
npm install npm#latest -g
I had the same problem, and I solve it:
uninstall node and npm, do as this answer.
then install node
brew install node
and npm will also be installed.

Resources