使用Nuxt时候报错:EPERM: operation not permitted

第一次使用Nuxt,环境都没有搭起来,各种报错。

其中一次提示如下信息:

Error: EPERM: operation not permitted

意思是权限不被允许。我用了几种方法都不行,目前这种方法有点反应了,便记录下来。

解决办法是如下:

1.删除项目根目录下的package-lock.json文件(不确定不删除是否可以);

2.删除node_modules文件夹

2.打开终端,运行npm cache clean --force;

3.在终端中执行cnpm install;

第一次执行cnpm install依然有问题,没看懂什么意思

第二次执行cnpm install貌似问题解决了

如下图所示(红色为执行过的命令,品红色成功提示):

Windows PowerShell
版权所有 (C) Microsoft Corporation。保留所有权利。

尝试新的跨平台 PowerShell https://aka.ms/pscore6

PS D:\heima\guili_vue\vue-admin-front-nuxt> npm cache clean --force
npm WARN using --force I sure hope you know what you are doing.
PS D:\heima\guili_vue\vue-admin-front-nuxt> cnpm install
\ [1/7] Installing signal-exit@^3.0.2platform unsupported [email protected] › @nuxt/[email protected][email protected] › fsevents@~2.1.2 Package require os(darwin) not compatible with your platform(win32)
| [1/7] Installing statuses@~1.5.0[fsevents@~2.1.2] optional install error: Package require os(darwin) not compatible with your platform(win32)       
- [6/7] Installing randombytes@^2.0.0
WARN node unsupported "[email protected]" is incompatible with [email protected] › @nuxt/[email protected][email protected][email protected][email protected] › watchpack-chokidar2@^2.0.0, expected node@<8.10.0
| [6/7] Installing randombytes@^2.0.1platform unsupported [email protected] › @nuxt/[email protected][email protected][email protected][email protected][email protected][email protected] › fsevents@^1.2.7 Package require os(darwin) not compatible with your platform(win32)
/ [6/7] Installing safe-buffer@^5.0.1[fsevents@^1.2.7] optional install error: Package require os(darwin) not compatible with your platform(win32)    
√ Installed 7 packages
√ Linked 933 latest versions
[1/3] scripts.postinstall [email protected] › @nuxt/[email protected][email protected] › ejs@^2.6.1 run "node ./postinstall.js", root: "D:\\heima\\guili_vue\\vue-admin-front-nuxt\\node_modules\\[email protected]@ejs"
Thank you for installing EJS: built with the Jake JavaScript build tool (https://jakejs.com/)

[1/3] scripts.postinstall [email protected] › @nuxt/[email protected][email protected] › ejs@^2.6.1 finished in 126ms
[2/3] scripts.postinstall [email protected] › @nuxt/[email protected] › @nuxt/[email protected] › core-js@^2.6.5 run "node -e \"try{require('./postinstall')}catch(e){}\"", root: "D:\\heima\\guili_vue\\vue-admin-front-nuxt\\node_modules\\[email protected]@core-js"
Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
> https://opencollective.com/core-js
> https://www.patreon.com/zloirock

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)

[2/3] scripts.postinstall [email protected] › @nuxt/[email protected] › @nuxt/[email protected] › core-js@^2.6.5 finished in 139ms
[3/3] scripts.postinstall nuxt@^2.0.0 run "opencollective || exit 0", root: "D:\\heima\\guili_vue\\vue-admin-front-nuxt\\node_modules\\[email protected]@nuxt"

                                     :-:
                                   .==-+:
                                  .==. :+- .-=-
                                 .==.   :==++-+=.
                                :==.     -**: :+=.
                               :+-      :*+++. .++.
                              :+-      -*= .++: .=+.
                             -+:      =*-   .+*: .=+:        
                            -+:     .=*-     .=*-  =+:       
                          .==:     .+*:        -*-  -+-      
                         .=+:.....:+*-.........:=*=..=*-     
                         .-=------=++============++====:     

                          Thanks for installing nuxtjs 
                 Please consider donating to our open collective
                        to help us maintain this package.


             Donate: https://opencollective.com/nuxtjs/donate

[3/3] scripts.postinstall nuxt@^2.0.0 finished in 3s
√ Run 3 scripts
peerDependencies link [email protected] in D:\heima\guili_vue\vue-admin-front-nuxt\node_modules\[email protected]@ajv-keywords unmet with D:\heima\guili_vue\vue-admin-front-nuxt\node_modules\ajv(6.12.4)
deprecate [email protected][email protected][email protected] › circular-json@^0.3.1 CircularJSON is in maintenance only, flatted is its successor.
deprecate [email protected] › @nuxt/[email protected][email protected][email protected][email protected][email protected] › chokidar@^2.1.8 Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
deprecate [email protected] › @nuxt/[email protected][email protected][email protected][email protected][email protected][email protected] › fsevents@^1.2.7 fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
[email protected] › urix@^0.1.0 Please see https://github.com/lydell/urix#deprecated
deprecate [email protected] › @nuxt/[email protected][email protected][email protected][email protected][email protected][email protected][email protected] › resolve-url@^0.2.1 https://github.com/lydell/resolve-url#deprecated
deprecate [email protected] › @nuxt/[email protected] › @nuxt/[email protected] › core-js@^2.6.5 core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
Recently updated (since 2020-08-10): 22 packages (detail see file D:\heima\guili_vue\vue-admin-front-nuxt\node_modules\.recently_updates.txt)
  Today:
    → nuxt@^2.0.0(2.14.3) (01:04:22)
    → [email protected] › @nuxt/[email protected](2.14.3) (01:03:34)
    → [email protected] › @nuxt/[email protected](2.14.3) (01:03:51)
    → [email protected] › @nuxt/[email protected](2.14.3) (01:03:38)
    → [email protected] › @nuxt/[email protected](2.14.3) (01:03:47)
    → [email protected] › @nuxt/[email protected](2.14.3) (01:04:18)
    → [email protected] › @nuxt/[email protected] › @nuxt/[email protected](2.14.3) (01:04:04)
    → [email protected] › @nuxt/[email protected] › @nuxt/[email protected](2.14.3) (01:04:09)
    → [email protected] › @nuxt/[email protected] › @nuxt/[email protected](2.14.3) (01:03:43)
    → [email protected] › @nuxt/[email protected] › @nuxt/[email protected](2.14.3) (01:03:55)
    → [email protected] › @nuxt/[email protected] › @nuxt/[email protected](2.14.3) (01:04:13)
    → [email protected] › @nuxt/[email protected] › @nuxt/[email protected](2.14.3) (01:03:30)
√ All packages installed (1097 packages installed from npm registry, used 17s(network 13s), speed 184.65kB/s, json 940(2.29MB), tarball 0B)
PS D:\heima\guili_vue\vue-admin-front-nuxt> cnpm install
√ Installed 7 packages
√ Linked 0 latest versions
√ Run 0 scripts
√ All packages installed (used 13ms(network 9ms), speed 0B/s, json 0(0B), tarball 0B)
PS D:\heima\guili_vue\vue-admin-front-nuxt> 

 

紧接着我又执行了启动命令

如下图所示(红色为执行过的命令,品红色成功提示):

PS D:\heima\guili_vue\vue-admin-front-nuxt> npm run dev

> [email protected] dev D:\heima\guili_vue\vue-admin-front-nuxt
> nuxt


i NuxtJS collects completely anonymous data about usage.                                                                                    14:31:22
  This will help us improving Nuxt developer experience over the time.
  Read more on https://git.io/nuxt-telemetry

? Are you interested in participation? Yes


 WARN  Address localhost:3000 is already in use.                                                                                            14:32:26

i Trying a random port...                                                                                                                   14:32:26  

   ╭────────────────────────────────────────╮
   │                                        │
   │   Nuxt.js @ v2.14.3                    │
   │                                        │
   │   ▸ Environment: development           │
   │   ▸ Rendering:   server-side           │
   │   ▸ Target:      server                │
   │                                        │
   │   Listening: http://localhost:60774/   │
   │                                        │
   ╰────────────────────────────────────────╯

i Preparing project for development                                                                                                         14:32:27
i Initial build may take a while                                                                                                            14:32:27
√ Builder initialized                                                                                                                       14:32:27
√ Nuxt files generated                                                                                                                      14:32:27

√ Client
  Compiled successfully in 5.43s

√ Server
  Compiled successfully in 5.03s

i Waiting for file changes                                                                                                                  14:32:35
i Memory usage: 204 MB (RSS: 275 MB)                                                                                                        14:32:35
i Listening on: http://localhost:60774/                                                                                                     14:32:35

 ERROR  [Vue warn]: Property or method "name" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.

found in

--->  at pages/index.vue
       
          at layouts/default.vue
           


 ERROR  [Vue warn]: Property or method "description" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.

found in

--->  at pages/index.vue
       
          at layouts/default.vue
           

 

然后可以访问了

访问如下网址,但我不知道为什么端口号是这个,之前变过好几次。

http://localhost:60774/
图一:

使用Nuxt时候报错:EPERM: operation not permitted_第1张图片

 

 

 图二:

使用Nuxt时候报错:EPERM: operation not permitted_第2张图片

第一次使用,貌似搭建成功了,之后再完善

安装幻灯片插件

同样遇见了问题,执行了两边下面代码才成功

在执行命令前需要先停止项目

npm install vue-awesome-swiper

如图:

终止批处理操作吗(Y/N)? y
PS D:\heima\guili_vue\vue-admin-front-nuxt> npm install vue-awesome-swiper
npm WARN deprecated [email protected]: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules\[email protected]@chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
。

。此处省略很多行

。 npm WARN @vue/[email protected] requires a peer of @babel/core@^7.0.0-0 but none is installed. You must install peer dependencies yourself. npm WARN @babel/[email protected] requires a peer of @babel/core@^7.0.0-0 but none is installed. You must install peer dependencies yourself. npm WARN @vue/[email protected] requires a peer of @babel/core@^7.0.0-0 but none is installed. You must install peer dependencies yourself. npm WARN [email protected] requires a peer of webpack@^4.40.2 but none is installed. You must install peer dependencies yourself. npm WARN [email protected] requires a peer of swiper@^5.2.0 but none is installed. You must install peer dependencies yourself. npm WARN [email protected] requires a peer of [email protected] but none is installed. You must install peer dependencies yourself. npm ERR! code ENOENT npm ERR! syscall rename npm ERR! path D:\heima\guili_vue\vue-admin-front-nuxt\node_modules\[email protected]@shebang-command\node_modules\shebang-regex npm ERR! dest D:\heima\guili_vue\vue-admin-front-nuxt\node_modules\[email protected]@shebang-command\node_modules\shebang-regex npm ERR! errno -4058 npm ERR! enoent ENOENT: no such file or directory, rename 'D:\heima\guili_vue\vue-admin-front-nuxt\node_modules\[email protected]@shebang-command\node_modules\shebang-regex' -> 'D:\heima\guili_vue\vue-admin-front-nuxt\node_modules\[email protected]@shebang-command\node_modules\shebang-regex' 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\oor\AppData\Roaming\npm-cache\_logs\2020-08-17T07_44_33_049Z-debug.log PS D:\heima\guili_vue\vue-admin-front-nuxt> npm install vue-awesome-swiper npm WARN registry Unexpected warning for https://registry.npmjs.org/: Miscellaneous Warning ETIMEDOUT: request to https://registry.npmjs.org/vue-awesome-swiper failed, reason: connect ETIMEDOUT 104.16.17.35:443 npm WARN registry Using stale data from https://registry.npmjs.org/ due to a request error during revalidation. npm notice created a lockfile as package-lock.json. You should commit this file. npm WARN [email protected] requires a peer of swiper@^5.2.0 but none is installed. You must install peer dependencies yourself. npm WARN [email protected] requires a peer of [email protected] but none is installed. You must install peer dependencies yourself. + [email protected] added 1 package from 1 contributor and removed 1954 packages in 401.678s

 

你可能感兴趣的:(使用Nuxt时候报错:EPERM: operation not permitted)