1. 程式人生 > 實用技巧 >使用Nuxt時候報錯:EPERM: operation not permitted

使用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 ajv@5.5.2 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 eslint@4.19.1 › [email protected][email protected] › circular-json@^0.3.1 CircularJSON is in maintenance only, flatted is its successor. deprecate nuxt@2.14.3 › @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 nuxt@2.14.3 › @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. resolve@0.5.3 › 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) → nuxt@2.14.3 › @nuxt/[email protected](2.14.3) (01:03:34) → nuxt@2.14.3 › @nuxt/[email protected](2.14.3) (01:03:51) → nuxt@2.14.3 › @nuxt/[email protected](2.14.3) (01:03:38) → nuxt@2.14.3 › @nuxt/[email protected](2.14.3) (01:03:47) → nuxt@2.14.3 › @nuxt/[email protected](2.14.3) (01:04:18) → nuxt@2.14.3 › @nuxt/[email protected] › @nuxt/[email protected](2.14.3) (01:04:04) → nuxt@2.14.3 › @nuxt/[email protected] › @nuxt/[email protected](2.14.3) (01:04:09) → nuxt@2.14.3 › @nuxt/[email protected] › @nuxt/[email protected](2.14.3) (01:03:43) → nuxt@2.14.3 › @nuxt/[email protected] › @nuxt/[email protected](2.14.3) (01:03:55) → nuxt@2.14.3 › @nuxt/[email protected] › @nuxt/[email protected](2.14.3) (01:04:13) → nuxt@2.14.3 › @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

---> <Pages/index.vue> at pages/index.vue
       <Nuxt>
         <Layouts/default.vue> at layouts/default.vue
           <Root>


 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

---> <Pages/index.vue> at pages/index.vue
       <Nuxt>
         <Layouts/default.vue> at layouts/default.vue
           <Root>

然後可以訪問了

訪問如下網址,但我不知道為什麼埠號是這個,之前變過好幾次。

http://localhost:60774/
圖一:

圖二:

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