[英]npm ERR! invalid options argument
Software![]() |
OS![]() |
npm ![]() |
npx ![]() |
node![]() |
---|---|---|---|---|
Version![]() |
Windows 10 ![]() |
v8.1.2 ![]() |
v8.1.2 ![]() |
v16.13.1 ![]() |
I was following this video and when I try to create a react application on my system by using the following command我正在关注这个视频,当我尝试使用以下命令在我的系统上创建一个反应应用程序时
npx create-react-app demo
It shows the following error:它显示以下错误:
npm ERR! invalid options argument
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\hp\AppData\Local\npm-cache\_logs\2021-12-07T16_44_17_434Z-debug.log
0 verbose cli [
0 verbose cli 'C:\\Program Files\\nodejs\\node.exe',
0 verbose cli 'C:\\Users\\hp\\AppData\\Roaming\\nvm\\v11.0.0\\node_modules\\npm\\bin\\npm-cli.js',
0 verbose cli 'exec',
0 verbose cli '--',
0 verbose cli 'create-react-app',
0 verbose cli 'demo'
0 verbose cli ]
1 info using npm@8.1.2
2 info using node@v16.13.1
3 timing npm:load:whichnode Completed in 1ms
4 timing config:load:defaults Completed in 1ms
5 timing config:load:file:C:\Users\hp\AppData\Roaming\nvm\v11.0.0\node_modules\npm\npmrc Completed in 2ms
6 timing config:load:builtin Completed in 3ms
7 timing config:load:cli Completed in 2ms
8 timing config:load:env Completed in 1ms
9 timing config:load:file:C:\Users\hp\OneDrive\Desktop\.npmrc Completed in 1ms
10 timing config:load:project Completed in 2ms
11 timing config:load:file:C:\Users\hp\.npmrc Completed in 1ms
12 timing config:load:user Completed in 1ms
13 timing config:load:file:C:\Users\hp\AppData\Roaming\npm\etc\npmrc Completed in 0ms
14 timing config:load:global Completed in 0ms
15 timing config:load:validate Completed in 1ms
16 timing config:load:credentials Completed in 1ms
17 timing config:load:setEnvs Completed in 1ms
18 timing config:load Completed in 13ms
19 timing npm:load:configload Completed in 13ms
20 timing npm:load:setTitle Completed in 0ms
21 timing npm:load:setupLog Completed in 1ms
22 timing config:load:flatten Completed in 4ms
23 timing npm:load:cleanupLog Completed in 2ms
24 timing npm:load:configScope Completed in 0ms
25 timing npm:load:projectScope Completed in 1ms
26 timing npm:load Completed in 22ms
27 verbose stack TypeError: invalid options argument
27 verbose stack at optsArg (C:\Users\hp\AppData\Roaming\nvm\v11.0.0\node_modules\npm\node_modules\mkdirp\lib\opts-arg.js:13:11)
27 verbose stack at mkdirp (C:\Users\hp\AppData\Roaming\nvm\v11.0.0\node_modules\npm\node_modules\mkdirp\index.js:11:10)
27 verbose stack at tryCatcher (C:\Users\hp\AppData\Roaming\nvm\v11.0.0\node_modules\npm\node_modules\bluebird\js\release\util.js:16:23)
27 verbose stack at ret (eval at makeNodePromisifiedEval (C:\Users\hp\AppData\Roaming\nvm\v11.0.0\node_modules\npm\node_modules\bluebird\js\release\promisify.js:184:12), <anonymous>:13:39)
27 verbose stack at Object.mkdirfix (C:\Users\hp\AppData\Roaming\nvm\v11.0.0\node_modules\npm\node_modules\npm-registry-fetch\node_modules\cacache\lib\util\fix-owner.js:36:10)
27 verbose stack at makeTmp (C:\Users\hp\AppData\Roaming\nvm\v11.0.0\node_modules\npm\node_modules\npm-registry-fetch\node_modules\cacache\lib\content\write.js:121:19)
27 verbose stack at write (C:\Users\hp\AppData\Roaming\nvm\v11.0.0\node_modules\npm\node_modules\npm-registry-fetch\node_modules\cacache\lib\content\write.js:35:19)
27 verbose stack at putData (C:\Users\hp\AppData\Roaming\nvm\v11.0.0\node_modules\npm\node_modules\npm-registry-fetch\node_modules\cacache\put.js:11:10)
27 verbose stack at Object.x.put (C:\Users\hp\AppData\Roaming\nvm\v11.0.0\node_modules\npm\node_modules\npm-registry-fetch\node_modules\cacache\locales\en.js:28:37)
27 verbose stack at WriteStream._flush (C:\Users\hp\AppData\Roaming\nvm\v11.0.0\node_modules\npm\node_modules\npm-registry-fetch\node_modules\make-fetch-happen\cache.js:156:21)
27 verbose stack at WriteStream._write (C:\Users\hp\AppData\Roaming\nvm\v11.0.0\node_modules\npm\node_modules\flush-write-stream\index.js:36:35)
27 verbose stack at doWrite (C:\Users\hp\AppData\Roaming\nvm\v11.0.0\node_modules\npm\node_modules\readable-stream\lib\_stream_writable.js:409:139)
27 verbose stack at writeOrBuffer (C:\Users\hp\AppData\Roaming\nvm\v11.0.0\node_modules\npm\node_modules\readable-stream\lib\_stream_writable.js:398:5)
27 verbose stack at WriteStream.Writable.write (C:\Users\hp\AppData\Roaming\nvm\v11.0.0\node_modules\npm\node_modules\readable-stream\lib\_stream_writable.js:307:11)
27 verbose stack at WriteStream.end (C:\Users\hp\AppData\Roaming\nvm\v11.0.0\node_modules\npm\node_modules\flush-write-stream\index.js:45:41)
27 verbose stack at WriteStream.end (C:\Users\hp\AppData\Roaming\nvm\v11.0.0\node_modules\npm\node_modules\flush-write-stream\index.js:42:47)
28 verbose cwd C:\Users\hp\OneDrive\Desktop
29 verbose Windows_NT 10.0.18363
30 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\hp\\AppData\\Roaming\\nvm\\v11.0.0\\node_modules\\npm\\bin\\npm-cli.js" "exec" "--" "create-react-app" "demo"
31 verbose node v16.13.1
32 verbose npm v8.1.2
33 error invalid options argument
34 verbose exit 1
Also tried running也试过跑步
npm i create-react-app -g demo
This resulted in the same error as above这导致与上述相同的错误
I also tried to clone an already working react application, and when I ran the following command to install dependencies我还尝试克隆一个已经在工作的反应应用程序,当我运行以下命令来安装依赖项时
npm i
This gave the following error:这给出了以下错误:
npm ERR! invalid options argument
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\hp\AppData\Local\npm-cache\_logs\2021-12-07T17_12_17_513Z-debug.log
When trying to clear the cache using npm cache clean --force
the following error occurs:尝试使用
npm cache clean --force
清除缓存时出现以下错误:
npm WARN using --force Recommended protections disabled.
Can someone help me understand what went wrong?有人可以帮我理解出了什么问题吗? Have I not done some installation correctly or missed out on any installation step?
我是否没有正确完成某些安装或错过了任何安装步骤? What can I do to get started with creating a react application on my machine?
我可以做些什么来开始在我的机器上创建一个 React 应用程序? Any kind of help is appreciated.
任何形式的帮助表示赞赏。 If you need any more information please let me know in the comments.
如果您需要更多信息,请在评论中告诉我。 Thanks!
谢谢!
The problem seems to be that of an inappropriate installation.问题似乎是安装不当。 The go to way to fix this would be to ensure a proper uninstall of
node
and npm
. go 解决此问题的方法是确保正确卸载
node
和npm
。 Please follow the steps mentioned here .请按照此处提到的步骤操作。 Once properly uninstalled, head over to install node and proceed with the re-installation.
正确卸载后,前往安装节点并继续重新安装。
I had a similar problem but using the arch linux operating system, this has not so much to do with whether you have done the installation well or not, sometimes some modules can interfere with each other due to compatibility issues.我有类似的问题,但是使用的是arch linux操作系统,这与您是否安装好没有太大关系,有时由于兼容性问题,某些模块会相互干扰。 In my case when I tracked the error, the error was in /usr/lib/node_modules/npm/node_modules/* .
在我跟踪错误的情况下,错误在 /usr/lib/node_modules/npm/node_modules/*中。 Although I uninstalled and reinstalled nodejs and npm it was not solved, so I decided to delete the node_modules folder completely once uninstalled node and then reinstall it.
虽然我卸载并重新安装了 nodejs 和 npm 但没有解决,所以我决定在卸载 node 后完全删除 node_modules 文件夹,然后重新安装。 In your case with Windows, the error sends you to the folder C:\UsersAppData\Roaming\nvm* .
在您使用 Windows 的情况下,错误会将您发送到文件夹 C:\UsersAppData\Roaming\nvm* 。 So I recommend you to uninstall nodejs and delete the nvm folder completely, since it is the one that is causing the error.
所以我建议你卸载 nodejs 并完全删除 nvm 文件夹,因为它是导致错误的那个。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.