vue-cli初始化项目时运行‘npm run dev’报错
npm run dev
无法启动
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'D:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'D:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'dev'
1 verbose cli ]
2 info using npm@6.14.5
3 info using node@v12.18.2
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle renren-fast-vue@1.2.2~predev: renren-fast-vue@1.2.2
6 info lifecycle renren-fast-vue@1.2.2~dev: renren-fast-vue@1.2.2
7 verbose lifecycle renren-fast-vue@1.2.2~dev: unsafe-perm in lifecycle true
8 verbose lifecycle renren-fast-vue@1.2.2~dev: PATH: D:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;E:\code\renren-fast-vue\node_modules\.bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\Program Files\nodejs;D:\Program Files (x86)\Yarn\bin;E:\jdk1.8.0_131\bin;E:\jdk1.8.0_131\jre\bin;E:\maven-3.6.3\bin;E:\hadoop\hadoop-2.7.3\bin;E:\PortableGit\cmd;E:\flutter\bin;E:\src\gradle-6.8.2\bin;C:\Users\01\AppData\Roaming\npm;C:\Program Files (x86)\SSH Communications Security\SSH Secure Shell;C:\Users\01\AppData\Local\Yarn\bin;D:\Program Files\Fiddler
9 verbose lifecycle renren-fast-vue@1.2.2~dev: CWD: E:\code\renren-fast-vue
10 silly lifecycle renren-fast-vue@1.2.2~dev: Args: [
10 silly lifecycle '/d /s /c',
10 silly lifecycle 'webpack-dev-server --inline --progress --config build/webpack.dev.conf.js'
10 silly lifecycle ]
11 silly lifecycle renren-fast-vue@1.2.2~dev: Returned: code: 1 signal: null
12 info lifecycle renren-fast-vue@1.2.2~dev: Failed to exec dev script
13 verbose stack Error: renren-fast-vue@1.2.2 dev: `webpack-dev-server --inline --progress --config build/webpack.dev.conf.js`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (D:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:315:20)
13 verbose stack at ChildProcess.<anonymous> (D:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:315:20)
13 verbose stack at maybeClose (internal/child_process.js:1021:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
14 verbose pkgid renren-fast-vue@1.2.2
15 verbose cwd E:\code\renren-fast-vue
16 verbose Windows_NT 6.1.7601
17 verbose argv "D:\\Program Files\\nodejs\\node.exe" "D:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "dev"
18 verbose node v12.18.2
19 verbose npm v6.14.5
20 error code ELIFECYCLE
21 error errno 1
22 error renren-fast-vue@1.2.2 dev: `webpack-dev-server --inline --progress --config build/webpack.dev.conf.js`
22 error Exit status 1
23 error Failed at the renren-fast-vue@1.2.2 dev script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
可能是没安装,执行一下安装语句
npm install --registry=https://registry.npm.taobao.org
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm ERR! code EEXIST
npm ERR! path E:\code\renren-fast-vue\node_modules\execa\node_modules\cross-spawn\node_modules\.bin\which.ps1
npm ERR! Refusing to delete E:\code\renren-fast-vue\node_modules\execa\node_modules\cross-spawn\node_modules\.bin\which.ps1: ../../../_which@1.3.1@which/bin/which symlink target is not controlled by n
pm E:\code\renren-fast-vue\node_modules\execa\node_modules\cross-spawn\node_modules\which
npm ERR! File exists: E:\code\renren-fast-vue\node_modules\execa\node_modules\cross-spawn\node_modules\.bin\which.ps1
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\01\AppData\Roaming\npm-cache\_logs\2021-02-10T08_37_19_781Z-debug.log
提示文件删除错误,可以添加强制参数
npm install --force --registry=https://registry.npm.taobao.org
npm WARN using --force I sure hope you know what you are doing.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/requ
est/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm ERR! code EEXIST
npm ERR! path E:\code\renren-fast-vue\node_modules\jest-cli\node_modules\node-notifier\node_modules\
.bin\which.ps1
npm ERR! Refusing to delete E:\code\renren-fast-vue\node_modules\jest-cli\node_modules\node-notifier
\node_modules\.bin\which.ps1: ../../../_which@1.3.1@which/bin/which symlink target is not controlled
by npm E:\code\renren-fast-vue\node_modules\jest-cli\node_modules\node-notifier\node_modules\which
npm ERR! File exists: E:\code\renren-fast-vue\node_modules\jest-cli\node_modules\node-notifier\node_
modules\.bin\which.ps1
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\01\AppData\Roaming\npm-cache\_logs\2021-02-10T08_53_34_140Z-debug.log
npm WARN using --force I sure hope you know what you are doing.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/requ
est/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm ERR! code EEXIST
npm ERR! path E:\code\renren-fast-vue\node_modules\webpack-dev-server\node_modules\portfinder\node_m
odules\.bin\mkdirp.ps1
npm ERR! Refusing to delete E:\code\renren-fast-vue\node_modules\webpack-dev-server\node_modules\por
tfinder\node_modules\.bin\mkdirp.ps1: ../../../_mkdirp@0.5.5@mkdirp/bin/cmd.js symlink target is not
controlled by npm E:\code\renren-fast-vue\node_modules\webpack-dev-server\node_modules\portfinder\n
ode_modules\mkdirp
npm ERR! File exists: E:\code\renren-fast-vue\node_modules\webpack-dev-server\node_modules\portfinde
r\node_modules\.bin\mkdirp.ps1
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\01\AppData\Roaming\npm-cache\_logs\2021-02-10T08_58_27_230Z-debug.log
接着把这些有错误的模块删了
cross-spawn
execa
jest-cli
webpack-dev-server
再试试
npm install --force --registry=https://registry.npm.taobao.org
npm WARN using --force I sure hope you know what you are doing.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/requ
est/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm ERR! code EEXIST
npm ERR! path E:\code\renren-fast-vue\node_modules\_webpack@3.6.0@webpack\node_modules\uglifyjs-webp
ack-plugin\node_modules\.bin\uglifyjs.ps1
npm ERR! Refusing to delete E:\code\renren-fast-vue\node_modules\_webpack@3.6.0@webpack\node_modules
\uglifyjs-webpack-plugin\node_modules\.bin\uglifyjs.ps1: ../../../_uglify-js@2.8.29@uglify-js/bin/ug
lifyjs symlink target is not controlled by npm E:\code\renren-fast-vue\node_modules\_webpack@3.6.0@w
ebpack\node_modules\uglifyjs-webpack-plugin\node_modules\uglify-js
npm ERR! File exists: E:\code\renren-fast-vue\node_modules\_webpack@3.6.0@webpack\node_modules\uglif
yjs-webpack-plugin\node_modules\.bin\uglifyjs.ps1
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\01\AppData\Roaming\npm-cache\_logs\2021-02-10T09_05_56_965Z-debug.log
继续删
_webpack@3.6.0@webpack
npm WARN using --force I sure hope you know what you are doing.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/requ
est/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm ERR! code EEXIST
npm ERR! path E:\code\renren-fast-vue\node_modules\_babel-preset-vue-app@1.3.2@babel-preset-vue-app\
node_modules\babel-preset-env\node_modules\.bin\browserslist.ps1
npm ERR! Refusing to delete E:\code\renren-fast-vue\node_modules\_babel-preset-vue-app@1.3.2@babel-p
reset-vue-app\node_modules\babel-preset-env\node_modules\.bin\browserslist.ps1: ../../../_browsersli
st@3.2.8@browserslist/cli.js symlink target is not controlled by npm E:\code\renren-fast-vue\node_mo
dules\_babel-preset-vue-app@1.3.2@babel-preset-vue-app\node_modules\babel-preset-env\node_modules\br
owserslist
npm ERR! File exists: E:\code\renren-fast-vue\node_modules\_babel-preset-vue-app@1.3.2@babel-preset-
vue-app\node_modules\babel-preset-env\node_modules\.bin\browserslist.ps1
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\01\AppData\Roaming\npm-cache\_logs\2021-02-10T09_11_39_526Z-debug.log
babel-preset-vue-app
_babel-preset-vue-app@1.3.2@babel-preset-vue-app
npm WARN using --force I sure hope you know what you are doing.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/requ
est/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm ERR! code EEXIST
npm ERR! path E:\code\renren-fast-vue\node_modules\_svgo@0.7.2@svgo\node_modules\js-yaml\node_module
s\.bin\esparse.ps1
npm ERR! Refusing to delete E:\code\renren-fast-vue\node_modules\_svgo@0.7.2@svgo\node_modules\js-ya
ml\node_modules\.bin\esparse.ps1: ../../../_esprima@2.7.3@esprima/bin/esparse.js symlink target is n
ot controlled by npm E:\code\renren-fast-vue\node_modules\_svgo@0.7.2@svgo\node_modules\js-yaml\node
_modules\esprima
npm ERR! File exists: E:\code\renren-fast-vue\node_modules\_svgo@0.7.2@svgo\node_modules\js-yaml\nod
e_modules\.bin\esparse.ps1
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\01\AppData\Roaming\npm-cache\_logs\2021-02-10T09_15_45_153Z-debug.log
只能全部删了
npm install --force --registry=https://registry.npm.taobao.org
Downloading https://chromedriver.storage.googleapis.com/2.27/chromedriver_win32.zip
Saving to C:\Users\01\AppData\Local\Temp\chromedriver\chromedriver_win32.zip
这个卡住了,只能手动下载,然后放到C:\Users\01\AppData\Local\Temp\chromedriver文件夹下,再运行
成功安装
npm run dev
error in ./src/assets/scss/index.scss
Module build failed: Error: ENOENT: no such file or directory, scandir 'E:\code\renren-fast-vue\node
_modules\node-sass\vendor'
at Object.readdirSync (fs.js:948:3)
at Object.getInstalledBinaries (E:\code\renren-fast-vue\node_modules\node-sass\lib\extensions.js
:132:13)
at foundBinariesList (E:\code\renren-fast-vue\node_modules\node-sass\lib\errors.js:20:15)
at foundBinaries (E:\code\renren-fast-vue\node_modules\node-sass\lib\errors.js:15:5)
at Object.module.exports.missingBinary (E:\code\renren-fast-vue\node_modules\node-sass\lib\error
s.js:45:5)
at module.exports (E:\code\renren-fast-vue\node_modules\node-sass\lib\binding.js:15:30)
at Object.<anonymous> (E:\code\renren-fast-vue\node_modules\node-sass\lib\index.js:14:35)
at Module._compile (internal/modules/cjs/loader.js:1138:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
at Module.load (internal/modules/cjs/loader.js:986:32)
at Function.Module._load (internal/modules/cjs/loader.js:879:14)
at Module.require (internal/modules/cjs/loader.js:1026:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (E:\code\renren-fast-vue\node_modules\sass-loader\lib\loader.js:3:14)
at Module._compile (internal/modules/cjs/loader.js:1138:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
@ ./src/assets/scss/index.scss 4:14-212 13:3-17:5 14:22-220
@ ./src/main.js
@ multi (webpack)-dev-server/client?http://localhost:8001 webpack/hot/dev-server babel-polyfill ./s
rc/main.js
重装一下node-sass
npm rebuild node-sass
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack at PythonFinder.failNoPython (E:\code\renren-fast-vue\node_modules\node-gyp\lib\c
onfigure.js:484:19)
gyp ERR! stack at PythonFinder.<anonymous> (E:\code\renren-fast-vue\node_modules\node-gyp\lib\co
nfigure.js:509:16)
gyp ERR! stack at callback (E:\code\renren-fast-vue\node_modules\graceful-fs\polyfills.js:299:20
)
gyp ERR! stack at FSReqCallback.oncomplete (fs.js:167:21)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "D:\\Program Files\\nodejs\\node.exe" "E:\\code\\renren-fast-vue\\node_modules\\nod
e-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldfla
gs=" "--libsass_library="
gyp ERR! cwd E:\code\renren-fast-vue\node_modules\node-sass
gyp ERR! node -v v12.18.2
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@4.13.1 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@4.13.1 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\01\AppData\Roaming\npm-cache\_logs\2021-02-10T09_49_30_958Z-debug.log
竟然需要装python
下载了3.9.1 提示需要win8以上
下载python-2.7.18.amd64.msi安装
最后才运行成功
以上为个人经验,希望能给大家一个参考,也希望大家多多支持阿兔在线工具。