vue添加axios报错

Posted Roam-G

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了vue添加axios报错相关的知识,希望对你有一定的参考价值。

PS C:\\CodeSpace2022\\Vue\\AndyVue\\src> npm install
npm ERR! code EINVALIDPACKAGENAME
npm ERR! Invalid package name "_axios@0.26.1@axios": name cannot start with an underscore; name can only contain URL-friendly characters 

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\\Users\\andyf\\AppData\\Roaming\\npm-cache\\_logs\\2022-04-03T17_04_02_602Z-debug.log
PS C:\\CodeSpace2022\\Vue\\AndyVue\\src> npm run dev
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path C:\\CodeSpace2022\\Vue\\AndyVue\\src\\package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'C:\\CodeSpace2022\\Vue\\AndyVue\\src\\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\\Users\\andyf\\AppData\\Roaming\\npm-cache\\_logs\\2022-04-03T17_07_07_748Z-debug.log
PS C:\\CodeSpace2022\\Vue\\AndyVue\\src>

0 info it worked if it ends with ok

1 verbose cli [

1 verbose cli   'C:\\\\Program Files\\\\nodejs\\\\node.exe',

1 verbose cli   'C:\\\\Program Files\\\\nodejs\\\\node_modules\\\\npm\\\\bin\\\\npm-cli.js',

1 verbose cli   'install'

1 verbose cli ]

2 info using npm@6.14.8

3 info using node@v12.19.0

4 verbose npm-session c428aef702fa3843

5 silly install runPreinstallTopLevelLifecycles

6 silly install loadCurrentTree

7 silly install readLocalPackageData

8 timing stage:loadCurrentTree Completed in 28ms

9 silly install loadIdealTree

10 silly install cloneCurrentTreeToIdealTree

11 timing stage:loadIdealTree:cloneCurrentTree Completed in 0ms

12 silly install loadShrinkwrap

13 timing stage:loadIdealTree:loadShrinkwrap Completed in 1ms

14 silly install loadAllDepsIntoIdealTree

15 timing stage:rollbackFailedOptional Completed in 0ms

16 timing stage:runTopLevelLifecycles Completed in 38ms

17 silly saveTree src

17 silly saveTree +-- axios@0.26.1

17 silly saveTree | `-- follow-redirects@1.14.9

17 silly saveTree `-- follow-redirects@1.14.9

18 verbose stack Error: Invalid package name "_axios@0.26.1@axios": name cannot start with an underscore; name can only contain URL-friendly characters

18 verbose stack     at invalidPackageName (C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\npm-package-arg\\npa.js:86:15)

18 verbose stack     at Result.setName (C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\npm-package-arg\\npa.js:121:11)

18 verbose stack     at new Result (C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\npm-package-arg\\npa.js:111:23)

18 verbose stack     at Function.resolve (C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\npm-package-arg\\npa.js:58:15)

18 verbose stack     at C:\\Program Files\\nodejs\\node_modules\\npm\\lib\\install\\deps.js:493:20

18 verbose stack     at Array.map (<anonymous>)

18 verbose stack     at C:\\Program Files\\nodejs\\node_modules\\npm\\lib\\install\\deps.js:492:47

18 verbose stack     at tryCatcher (C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\bluebird\\js\\release\\util.js:16:23)

18 verbose stack     at Promise._settlePromiseFromHandler (C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\bluebird\\js\\release\\promise.js:517:31)

18 verbose stack     at Promise._settlePromise (C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\bluebird\\js\\release\\promise.js:574:18)

18 verbose stack     at Promise._settlePromiseCtx (C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\bluebird\\js\\release\\promise.js:611:10)

18 verbose stack     at _drainQueueStep (C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\bluebird\\js\\release\\async.js:142:12)

18 verbose stack     at _drainQueue (C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\bluebird\\js\\release\\async.js:131:9)

18 verbose stack     at Async._drainQueues (C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\bluebird\\js\\release\\async.js:147:5)

18 verbose stack     at Immediate.Async.drainQueues [as _onImmediate] (C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\bluebird\\js\\release\\async.js:17:14)

18 verbose stack     at processImmediate (internal/timers.js:461:21)

19 verbose cwd C:\\CodeSpace2022\\Vue\\AndyVue\\src

20 verbose Windows_NT 10.0.19043

21 verbose argv "C:\\\\Program Files\\\\nodejs\\\\node.exe" "C:\\\\Program Files\\\\nodejs\\\\node_modules\\\\npm\\\\bin\\\\npm-cli.js" "install"

22 verbose node v12.19.0

23 verbose npm  v6.14.8

24 error code EINVALIDPACKAGENAME

25 error Invalid package name "_axios@0.26.1@axios": name cannot start with an underscore; name can only contain URL-friendly characters

26 verbose exit [ 1, true ]

以上是关于vue添加axios报错的主要内容,如果未能解决你的问题,请参考以下文章

axios post请求报错

vue + axios 图片上传

Django+vue前后端分离 用axios post请求报错问题

vue 使用axios 报错Error: Request failed with status code 404

vue中使用axios简单封装用法,axios报错the request was rejected because no multipart boundar

vue框架中webpack更新了,怎么获取本地数据,安装了npm install axios --save也不想,一直报错