配置VUE环境

在尝试配置Vue环境的过程中,遇到了一些问题。首先检查了Node.js和npm的版本,然后尝试全局安装Vue,但遇到了权限错误。接着,尝试设置执行策略为RemoteSigned,但在系统权限上遇到阻碍。最后成功安装了Vue CLI并初始化了一个名为vuetest的项目,但在项目创建过程中遇到了一些依赖包的警告和错误,项目最终成功启动于本地8080端口。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

PS D:\VUE-cli> node -v
v12.13.0
PS D:\VUE-cli> npm -v
6.12.0
PS D:\VUE-cli> vue -v
vue : 无法加载文件 C:\Users\Lenovo\AppData\Roaming\npm\vue.ps1,因为在此系统上禁止运行脚本。
有关详细信息,请参阅 https:/go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Poli
cies。
所在位置 行:1 字符: 1

  • vue -v
  •   + CategoryInfo          : SecurityError: (:) [],PSSecurityException
      + FullyQualifiedErrorId : UnauthorizedAccess
    

PS D:\VUE-cli> npm install vue
npm WARN saveError ENOENT: no such file or directory, open ‘D:\VUE-cli\package.json’
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open ‘D:\VUE-cli\package.json’
npm WARN VUE-cli No description
npm WARN VUE-cli No repository field.
npm WARN VUE-cli No README data
npm WARN VUE-cli No license field.

  • vue@2.6.10
    added 1 package from 1 contributor and audited 1 package in 6.079s
    found 0 vulnerabilities

PS D:\VUE-cli> vue -v
vue : 无法加载文件 C:\Users\Lenovo\AppData\Roaming\npm\vue.ps1,因为在此系统上禁止运行脚本。
有关详细信息,请参阅 https:/go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Poli
cies。
所在位置 行:1 字符: 1

  • vue -v
  •   + CategoryInfo          : SecurityError: (:) [],PSSecurityException
      + FullyQualifiedErrorId : UnauthorizedAccess
    

PS D:\VUE-cli> npm install vue -g

  • vue@2.6.10
    added 1 package from 1 contributor in 2.244s
    PS D:\VUE-cli> vue -v
    vue : 无法加载文件 C:\Users\Lenovo\AppData\Roaming\npm\vue.ps1,因为在此系统上禁止运行脚本。
    有关详细信息,请参阅 https:/go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Poli
    cies。
    所在位置 行:1 字符: 1
  • vue -v
  •   + CategoryInfo          : SecurityError: (:) [],PSSecurityException
      + FullyQualifiedErrorId : UnauthorizedAccess
    

PS D:\VUE-cli> cd dev
cd : 找不到路径“D:\VUE-cli\dev”,因为该路径不存在。
所在位置 行:1 字符: 1

  • cd dev
  •   + CategoryInfo          : ObjectNotFound: (D:\VUE-cli\dev:String) [Set-Location], ItemN
     otFoundException
      + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetLocationCommand
    
    

PS D:\VUE-cli> cd dev
PS D:\VUE-cli\dev> npm install vue-cli -g
npm WARN deprecated vue-cli@2.9.6: This package has been deprecated in favour of @vue/cli
npm WARN deprecated coffee-script@1.12.7: CoffeeScript on NPM has moved to “coffeescript” (no hyphen)
C:\Users\Lenovo\AppData\Roaming\npm\vue -> C:\Users\Lenovo\AppData\Roaming\npm\node_modules\vue-cli\bin\vue
C:\Users\Lenovo\AppData\Roaming\npm\vue-init -> C:\Users\Lenovo\AppData\Roaming\npm\node_modules\vue-cli\bin\vue-init
C:\Users\Lenovo\AppData\Roaming\npm\vue-list -> C:\Users\Lenovo\AppData\Roaming\npm\node_modules\vue-cli\bin\vue-list

  • vue-cli@2.9.6
    updated 1 package in 42.683s
    PS D:\VUE-cli\dev> cd vueproject
    cd : 找不到路径“D:\VUE-cli\dev\vueproject”,因为该路径不存在。
    所在位置 行:1 字符: 1
  • cd vueproject
  •   + CategoryInfo          : ObjectNotFound: (D:\VUE-cli\dev\vueproject:String) [Set-Locat
     ion], ItemNotFoundException
      + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetLocationCommand
    
    

PS D:\VUE-cli\dev> cd vueproject
PS D:\VUE-cli\dev\vueproject> vue init vuetest
vue : 无法加载文件 C:\Users\Lenovo\AppData\Roaming\npm\vue.ps1,因为在此系统上禁止运行脚本。
有关详细信息,请参阅 https:/go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Poli
cies。
所在位置 行:1 字符: 1

  • vue init vuetest
  •   + CategoryInfo          : SecurityError: (:) [],PSSecurityException
      + FullyQualifiedErrorId : UnauthorizedAccess
    

PS D:\VUE-cli\dev\vueproject>
PS D:\VUE-cli\dev\vueproject>
PS D:\VUE-cli\dev\vueproject> vue init webpack vuetest
vue : 无法加载文件 C:\Users\Lenovo\AppData\Roaming\npm\vue.ps1,因为在此系统上禁止运行脚本。
有关详细信息,请参阅 https:/go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Poli
cies。
所在位置 行:1 字符: 1

  • vue init webpack vuetest
  •   + CategoryInfo          : SecurityError: (:) [],PSSecurityException
      + FullyQualifiedErrorId : UnauthorizedAccess
    

PS D:\VUE-cli\dev\vueproject> npm install --global vue-cli
npm WARN deprecated vue-cli@2.9.6: This package has been deprecated in favour of @vue/cli
npm WARN deprecated coffee-script@1.12.7: CoffeeScript on NPM has moved to “coffeescript” (no hyphen)
C:\Users\Lenovo\AppData\Roaming\npm\vue -> C:\Users\Lenovo\AppData\Roaming\npm\node_modules\vue-cli\bin\vue
C:\Users\Lenovo\AppData\Roaming\npm\vue-init -> C:\Users\Lenovo\AppData\Roaming\npm\node_modules\vue-cli\bin\vue-init
C:\Users\Lenovo\AppData\Roaming\npm\vue-list -> C:\Users\Lenovo\AppData\Roaming\npm\node_modules\vue-cli\bin\vue-list

  • vue-cli@2.9.6
    updated 1 package in 62.872s
    PS D:\VUE-cli\dev\vueproject> vue -v
    vue : 无法加载文件 C:\Users\Lenovo\AppData\Roaming\npm\vue.ps1,因为在此系统上禁止运行脚本。
    有关详细信息,请参阅 https:/go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Poli
    cies。
    所在位置 行:1 字符: 1
  • vue -v
  •   + CategoryInfo          : SecurityError: (:) [],PSSecurityException
      + FullyQualifiedErrorId : UnauthorizedAccess
    

PS D:\VUE-cli\dev\vueproject> vue init vuetest
vue : 无法加载文件 C:\Users\Lenovo\AppData\Roaming\npm\vue.ps1,因为在此系统上禁止运行脚本。
有关详细信息,请参阅 https:/go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Poli
cies。
所在位置 行:1 字符: 1

  • vue init vuetest
  •   + CategoryInfo          : SecurityError: (:) [],PSSecurityException
      + FullyQualifiedErrorId : UnauthorizedAccess
    

PS D:\VUE-cli\dev\vueproject> vue init webpack vuetest
vue : 无法加载文件 C:\Users\Lenovo\AppData\Roaming\npm\vue.ps1,因为在此系统上禁止运行脚本。
有关详细信息,请参阅 https:/go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Poli
cies。
所在位置 行:1 字符: 1

  • vue init webpack vuetest
  •   + CategoryInfo          : SecurityError: (:) [],PSSecurityException
      + FullyQualifiedErrorId : UnauthorizedAccess
    

PS D:\VUE-cli\dev\vueproject> vue init webpack my-project
vue : 无法加载文件 C:\Users\Lenovo\AppData\Roaming\npm\vue.ps1,因为在此系统上禁止运行脚本。
有关详细信息,请参阅 https:/go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Poli
cies。
所在位置 行:1 字符: 1

  • vue init webpack my-project
  •   + CategoryInfo          : SecurityError: (:) [],PSSecurityException
      + FullyQualifiedErrorId : UnauthorizedAccess
    

PS D:\VUE-cli\dev\vueproject> ^C
PS D:\VUE-cli\dev\vueproject> set-ExecutionPolicy RemoteSigned

执行策略更改
执行策略可帮助你防止执行不信任的脚本。更改执行策略可能会产生安全风险,如
https:/go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Policies
帮助主题所述。是否要更改执行策略?
[Y] 是(Y) [A] 全是(A) [N] 否(N) [L] 全否(L) [S] 暂停(S) [?] 帮助
(默认值为“N”):Y
set-ExecutionPolicy : 对注册表项“HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell
1\ShellIds\Microsoft.PowerShell”的访问被拒绝。 要更改默认(LocalMachine)作用域的执
行策略,请使用“以管理员身份运行”选项启动 Windows PowerShell。要更改当前用户的执行
策略,请运行 “Set-ExecutionPolicy -Scope CurrentUser”。
所在位置 行:1 字符: 1

  • set-ExecutionPolicy RemoteSigned
  •   + CategoryInfo          : PermissionDenied: (:) [Set-ExecutionPolicy], Unautho
     rizedAccessException
      + FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.PowerSh
     ell.Commands.SetExecutionPolicyCommand
    

PS D:\VUE-cli\dev\vueproject> Set-ExecutionPolicy -Scope CurrentUser

位于命令管道位置 1 的 cmdlet Set-ExecutionPolicy
请为以下参数提供值:
ExecutionPolicy: 1

执行策略更改
执行策略可帮助你防止执行不信任的脚本。更改执行策略可能会产生安全风险,如
https:/go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Policies
帮助主题所述。是否要更改执行策略?
[Y] 是(Y) [A] 全是(A) [N] 否(N) [L] 全否(L) [S] 暂停(S) [?] 帮助 (默认值为“N”): A
PS D:\VUE-cli\dev\vueproject> vue -c
error: unknown option `-c’
PS D:\VUE-cli\dev\vueproject> npm install vue
npm WARN saveError ENOENT: no such file or directory, open ‘D:\VUE-cli\package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘D:\VUE-cli\package.json’
npm WARN VUE-cli No description
npm WARN VUE-cli No repository field.
npm WARN VUE-cli No README data
npm WARN VUE-cli No license field.

  • vue@2.6.10
    updated 1 package and audited 1 package in 1.835s
    found 0 vulnerabilities

PS D:\VUE-cli\dev\vueproject> npm install vue -g

  • vue@2.6.10
    updated 1 package in 1.993s
    PS D:\VUE-cli\dev\vueproject> vue init vuetest

? Generate project in current directory? Yes
vue-cli · Failed to download repo vuejs-templates/vuetest: Response code 404 (Not Found)

PS D:\VUE-cli\dev\vueproject> vue init webpack vuetest

? Project name vuetest
? Project description A Vue.js project
? Author wlr 1852315370@qq.com
? Vue build standalone
? Install vue-router? Yes
? Use ESLint to lint your code? No
? Set up unit tests Yes
? Pick a test runner jest
? Setup e2e tests with Nightwatch? No
? Should we run npm install for you after the project has been created? (recommended) npm

vue-cli · Generated “vuetest”.

Installing project dependencies …

========================

npm WARN deprecated extract-text-webpack-plugin@3.0.2: Deprecated. Please use https://github.com/webpack-contrib/mini-css-extract-plugin
npm WARN deprecated browserslist@2.11.3: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated bfj-node4@5.3.1: Switch to the bfj package for fixes and new features!
npm WARN deprecated core-js@2.6.10: core-js@❤️.0 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.
npm WARN deprecated browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated left-pad@1.3.0: use String.prototype.padStart()
npm WARN tarball tarball data for prettier@^1.7.0 (sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==) seems to be corrupted. Trying one more time.
npm WARN ajv-keywords@3.4.1 requires a peer of ajv@^6.9.1 but none is installed. You must install peer dependencies yourself.

npm ERR! code EPERM
npm ERR! syscall unlink
npm ERR! path D:\VUE-cli\dev\vueproject\vuetest\node_modules.staging\prettier-822ffea2\parser-typescript.js
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, unlink ‘D:\VUE-cli\dev\vueproject\vuetest\node_modules.staging\prettier-822ffea2\parser-typescript.js’
npm ERR! [OperationalError: EPERM: operation not permitted, unlink ‘D:\VUE-cli\dev\vueproject\vuetest\node_modules.staging\prettier-822ffea2\parser-typescript.js’] {
npm ERR! cause: [Error: EPERM: operation not permitted, unlink ‘D:\VUE-cli\dev\vueproject\vuetest\node_modules.staging\prettier-822ffea2\parser-typescript.js’] {
npm ERR! errno: -4048,
npm ERR! code: ‘EPERM’,
npm ERR! syscall: ‘unlink’,
npm ERR! path: ‘D:\VUE-cli\dev\vueproject\vuetest\node_modules\.staging\prettier-822ffea2\parser-typescript.js’
npm ERR! },
npm ERR! stack: “Error: EPERM: operation not permitted, unlink ‘D:\VUE-cli\dev\vueproject\vuetest\node_modules\.staging\prettier-822ffea2\parser-typescript.js’”,
npm ERR! errno: -4048,
npm ERR! code: ‘EPERM’,
npm ERR! syscall: ‘unlink’,
npm ERR! path: ‘D:\VUE-cli\dev\vueproject\vuetest\node_modules\.staging\prettier-822ffea2\parser-typescript.js’,
npm ERR! parent: ‘vuetest’
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It’s possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Lenovo\AppData\Roaming\npm-cache_logs\2019-11-22T01_24_58_112Z-debug.log

Project initialization finished!

========================

To get started:

cd vuetest
npm run dev

Documentation can be found at https://vuejs-templates.github.io/webpack

PS D:\VUE-cli\dev\vueproject> vue -v
error: unknown option `-v’
PS D:\VUE-cli\dev\vueproject> vue
Usage: vue [options]

Options:
-V, --version output the version number
-h, --help output usage information

Commands:
init generate a new project from a template
list list available official templates
build prototype a new project
create (for v3 warning only)
help [cmd] display help for [cmd]
PS D:\VUE-cli\dev\vueproject> vue -v
error: unknown option `-v’
PS D:\VUE-cli\dev\vueproject> npm install vue
npm WARN saveError ENOENT: no such file or directory, open ‘D:\VUE-cli\package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘D:\VUE-cli\package.json’
npm WARN VUE-cli No description
npm WARN VUE-cli No repository field.
npm WARN VUE-cli No README data
npm WARN VUE-cli No license field.

  • vue@2.6.10
    updated 1 package and audited 1 package in 2.883s
    found 0 vulnerabilities

PS D:\VUE-cli\dev\vueproject> vue -v
error: unknown option `-v’
PS D:\VUE-cli\dev\vueproject> vue install vue -g
PS D:\VUE-cli\dev\vueproject> npm install vue -g

  • vue@2.6.10
    updated 1 package in 4.049s
    PS D:\VUE-cli\dev\vueproject> cd dev
    cd : 找不到路径“D:\VUE-cli\dev\vueproject\dev”,因为该路径不存在。
    所在位置 行:1 字符: 1
  • cd dev
  •   + CategoryInfo          : ObjectNotFound: (D:\VUE-cli\dev\vueproject\dev:String) [Set-Location], I
     temNotFoundException
      + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetLocationCommand
    
    

PS D:\VUE-cli\dev\vueproject> npm install vue-cli -g
npm WARN deprecated vue-cli@2.9.6: This package has been deprecated in favour of @vue/cli
npm WARN deprecated coffee-script@1.12.7: CoffeeScript on NPM has moved to “coffeescript” (no hyphen)
C:\Users\Lenovo\AppData\Roaming\npm\vue -> C:\Users\Lenovo\AppData\Roaming\npm\node_modules\vue-cli\bin\vue
C:\Users\Lenovo\AppData\Roaming\npm\vue-init -> C:\Users\Lenovo\AppData\Roaming\npm\node_modules\vue-cli\bin\vue-init
C:\Users\Lenovo\AppData\Roaming\npm\vue-list -> C:\Users\Lenovo\AppData\Roaming\npm\node_modules\vue-cli\bin\vue-list

  • vue-cli@2.9.6
    updated 1 package in 55.101s
    PS D:\VUE-cli\dev\vueproject> vue init vuetest

? Generate project in current directory? Yes
vue-cli · Failed to download repo vuejs-templates/vuetest: Response code 404 (Not Found)

PS D:\VUE-cli\dev\vueproject> y
y : 无法将“y”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确
保路径正确,然后再试一次。
所在位置 行:1 字符: 1

  • y
  • ~
    • CategoryInfo : ObjectNotFound: (y:String) [], CommandNotFoundException
    • FullyQualifiedErrorId : CommandNotFoundException

PS D:\VUE-cli\dev\vueproject> vue init webpack vuetest

? Project name vuetest
? Project description A Vue.js project
? Author wlr 1852315370@qq.com
? Vue build standalone
? Install vue-router? Yes
? Use ESLint to lint your code? No
? Set up unit tests No
? Setup e2e tests with Nightwatch? No
? Should we run npm install for you after the project has been created? (recommended) npm

vue-cli · Generated “vuetest”.

Installing project dependencies …

========================

npm WARN deprecated extract-text-webpack-plugin@3.0.2: Deprecated. Please use https://github.com/webpack-contrib/mini-css-extract-plugin
npm WARN deprecated browserslist@2.11.3: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated bfj-node4@5.3.1: Switch to the bfj package for fixes and new features!
npm WARN deprecated core-js@2.6.10: core-js@❤️.0 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.
npm WARN deprecated browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.

core-js@2.6.10 postinstall D:\VUE-cli\dev\vueproject\vuetest\node_modules\core-js
node postinstall || echo “ignore”

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 -)

ejs@2.7.4 postinstall D:\VUE-cli\dev\vueproject\vuetest\node_modules\ejs
node ./postinstall.js

Thank you for installing EJS: built with the Jake JavaScript build tool (https://jakejs.com/)

uglifyjs-webpack-plugin@0.4.6 postinstall D:\VUE-cli\dev\vueproject\vuetest\node_modules\webpack\node_modules\uglifyjs-webpack-plugin
node lib/post_install.js

npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN ajv-keywords@3.4.1 requires a peer of ajv@^6.9.1 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“win32”,“arch”:“x64”})

added 1216 packages from 669 contributors and audited 11868 packages in 60.365s
found 11 vulnerabilities (1 low, 6 moderate, 4 high)
run npm audit fix to fix them, or npm audit for details

Project initialization finished!

========================

To get started:

cd vuetest
npm run dev

Documentation can be found at https://vuejs-templates.github.io/webpack

PS D:\VUE-cli\dev\vueproject> cd vuetest
PS D:\VUE-cli\dev\vueproject\vuetest> npm run dev

vuetest@1.0.0 dev D:\VUE-cli\dev\vueproject\vuetest
webpack-dev-server --inline --progress --config build/webpack.dev.conf.js

13% building modules 29/31 modules 2 active …li\dev\vueproject\vuetest\src\App.vue{ parser: “babylon” } is deprecated; we now treat it as { parser: “babel” }.
95% emitting

DONE Compiled successfully in 2297ms 9:36:49

I Your application is running here: http://localhost:8080

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值