简体   繁体   English

如何解决错误:找不到模块'json-parse-helpfulerror'

[英]How to solve error: Cannot find module 'json-parse-helpfulerror'

In Windows, I tried to create a new application form of this site: https://facebook.github.io/react/docs/installation.html在 Windows 中,我尝试创建本网站的新申请表: 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:首先,我安装了 Node.js v8.2.1,当我执行npm install -g create-react-app ,出现以下错误:

npm ERR! code MODULE_NOT_FOUND
npm ERR! Cannot find module 'json-parse-helpfulerror'

npm-debug.log: 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 ]

在目录文件夹中,发出以下命令:

npm update

Remove npm and reinstall it删除 npm 并重新安装

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.看Users文件夹里面要求的是什么,好像应该是作为全局包安装的。

Check and install each required package.检查并安装每个必需的软件包。

npm i -g json-parse-helpfulerror
  1. You must uninstall nodejs and npm packages.您必须卸载 nodejs 和 npm 包。
  2. after first, you must install npm.首先,您必须安装 npm。
  3. and you should install "npm install --save json-parse-better-errors"你应该安装“npm install --save json-parse-better-errors”
  4. Finally you can run your project最后你可以运行你的项目

https://www.npmjs.com/package/json-parse-better-errors https://www.npmjs.com/package/json-parse-better-errors

I fixed it by removing the node_modules folder and reinstalling it again.我通过删除node_modules文件夹并重新安装来修复它。 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 .要删除该文件夹,请转到您的项目文件夹并运行$ rm -rf node_modules ,然后使用您首选的包管理器( npm iyarn install重新安装您的包。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM