nodeJS安装问题,各种尝试解决之后记录问题。
nodejs到官网下载安装不多说。
安装完成之后运行报错提示:
PS E:\project\源代码库\vue-element-admin-master> npm run dev
> vue-element-admin@4.2.1 dev E:\project\源代码库\vue-element-admin-master
> vue-cli-service serve
'vue-cli-service' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vue-element-admin@4.2.1 dev: `vue-cli-service serve`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vue-element-admin@4.2.1 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\WJP\AppData\Roaming\npm-cache\_logs\2020-04-18T07_04_19_333Z-debug.log
解决:在项目目录下运行 cnpm install
PS E:\project\源代码库\vue-element-admin-master> cnpm install
| [22/56] Installing @babel/core@^7.0.0[tui-editor@1.3.3 › squire-rte@github:sohee-lee7/Squire#b1e0e1031fa18912d233c204c
be7c7fae4a42621] install squire-rte from git github:sohee-lee7/Squire#b1e0e1031fa18912d233c204cbe7c7fae4a42621, may be v
ery slow, please keep patience
......
再次启动报错提示:
10% building 2/2 modules 0 active ERROR Error: Cannot find module 'core-js/modules/es6.regexp.constructor'
解决: 在程序中搜索PowerShell 管理员身份打开运行 set-ExecutionPolicy RemoteSigned 策略设置为A
Windows PowerShell
版权所有 (C) 2015 Microsoft Corporation。保留所有权利。
PS C:\Windows\system32> set-ExecutionPolicy RemoteSigned
执行策略更改
执行策略可帮助你防止执行不信任的脚本。更改执行策略可能会产生安全风险,如
http://go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Policies 帮助主题所述。是否要更改执行策略?
[Y] 是(Y) [A] 全是(A) [N] 否(N) [L] 全否(L) [S] 暂停(S) [?] 帮助 (默认值为“N”): a
PS C:\Windows\system32> get-ExecutionPolicy
RemoteSigned
安装es6语法 : cnpm install core-js@2
PS E:\project\源代码库\vue-element-admin-master> cnpm install core-js@2
再次启动 npm run dev
成功 !