Vue项目运行报错,求大神详细解答


#1

新下载了vscode,用来运行vue项目,输入npm run dev命令,之前还是可以正常运行的,今天一早开电脑运行项目就报错了,搞了一天没解决问题。百度来的方案 ” 删除node_modules文件夹,npm install或者cpm install ” 都试过了 ,没有用。报错内容如下:

PS D:\vueProject\lyy> npm run dev

ks@1.0.0 dev D:\vueProject\lyy
webpack-dev-server --inline --progress --config build/webpack.dev.conf.js
D:\vueProject\lyy\node_modules\webpack-dev-server\bin\webpack-dev-server.js:8
const debug = require(‘debug’)(‘webpack-dev-server’);
^^^^^
SyntaxError: Use of const in strict mode.
at Module._compile (module.js:439:25)
at Object.Module._extensions…js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:935:3

npm ERR! ks@1.0.0 dev: webpack-dev-server --inline --progress --config build/webpack.dev.conf.js
npm ERR! Exit status 8
npm ERR!
npm ERR! Failed at the ks@1.0.0 dev script.
npm ERR! This is most likely a problem with the ks package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! webpack-dev-server --inline --progress --config build/webpack.dev.conf.js
npm ERR! You can get their info via:
npm ERR! npm owner ls ks
npm ERR! There is likely additional logging output above.
npm ERR! System Windows_NT 6.2.9200
npm ERR! command “C:\AppCan\AppCanStudioPersonalV3.3\HDK\emulator\mas\\node.exe” “C:\AppCan\AppCanStudioPersonalV3.3\HDK\emulator\mas\node_modules\npm\bin\npm-cli.js” “run” “dev”
npm ERR! cwd D:\vueProject\lyy
npm ERR! node -v v0.10.38
npm ERR! npm -v 1.4.3
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! D:\vueProject\lyy\npm-debug.log
npm ERR! not ok code 0


#2

因为你运行项目的时候,调用的是 AppCan 自带的node,版本太低了,不认识 const


#3

怎么样让它调用最新的,而不是appcan的node。


#4

这个东西没接触过,我尝试一下吧。


#5

我的电脑/此电脑 - 右键属性 - 高级系统设置 - 环境变量 - 系统变量 - path - 编辑
截图看看


#6

%APPCAN_PATH%;%APPCAN_PATH%;%APPCAN_PATH%;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client;C:\Program Files\Intel\iCLS Client;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\Intel\Intel® Management Engine Components\DAL;C:\Program Files\Intel\Intel® Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel® Management Engine Components\IPT;C:\Program Files\Intel\Intel® Management Engine Components\IPT;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\TortoiseSVN\bin;%JAVA_HOME%\lib;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0;%SYSTEMROOT%\System32\OpenSSH;"%JAVA_HOME%\bin;%JAVA_HOME%\jre\bin";C:\Users\User\


#7

咱能好好整理一下再发出来吗?


#8

好办,卸载node,下载最新稳定版本node.js,安装,done


#9

下载过最新的node了,但是进入项目为目录下,查看node版本,是appcan下node的版本,才0点多,


#10

给你百度到了解决方案:
https://blog.csdn.net/tonhex_lan/article/details/66968100


#11

删除node_modules,npm cache clean --force ,npm install ,npm run dev