使用vue-cli初始化项目时运行‘npm run dev’报错及解决

目录
  • vue-cli初始化项目时运行‘npm run dev’报错

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安装

最后才运行成功

以上为个人经验,希望能给大家一个参考,也希望大家多多支持我们。

(0)

相关推荐

  • npm run dev失败的简单解决办法

    目录 记录学习TS和Vue过程中遇到的问题及解决办法 解决办法: 总结 记录学习TS和Vue过程中遇到的问题及解决办法 下载好相关依赖包后,每次npm run dev时,都会出现以下问题: 输入yes进行下载,但是不会下载成功.输入NO则会直接结束,不会执行. 于是我根据yes之后的报错信息,去到log里面查看 嗯,看了半天没看懂! 于是我就查看依赖包的版本号是否有问题,版本号如下: 于是根据版本号再到处收集相关信息,终于找到问题了! 我们报错的提示是webpack-cli这个包出现了问题,问你

  • 运行npm run dev报错的原因及解决

    目录 项目场景: 问题描述 原因分析: 解决方案: 总结 项目场景: 提示:这里简述项目相关背景: 例如:项目场景:导入Spring Boot+vue项目时,运行npm run dev报错 问题描述 提示:这里描述项目中遇到的问题:运行npm run dev报错,在网上试了好多方法,都没解决. 原因分析: 提示:这里填写问题的分析:Note that the development build is not optimized.To create a production build, run

  • 详解Vue项目在其他电脑npm run dev运行报错的解决方法

    一个 Vue 项目从一台电脑上传到 github 上之后,再另外一台电脑上 git clone .并使用 npm run dev 或 npm run start 发生以下报错的解决方法. 报错原因 缺少 node_modules 里面的依赖.在项目目录下使用 npm install 然后再 npm run dev. 如果在这一步当中, npm install 执行的过程中,处于一直卡顿的状态.说明网络状况不佳.建议使用 cnpm 淘宝源. 淘宝源 使用 cnpm -v 查看是否已经安装 cnpm

  • 详解vuejs中执行npm run dev出现页面cannot GET/问题

    1.问题描述 最近用vue-cli搭建了一个小项目,其中在对项目进行打包测试时修改了webpack.base.conf.js中的配置信息,之后再用npm run dev之后出现如下的情况: 1.浏览器中无法呈现已有页面,并且在浏览器控制台中报404错误 2.命令窗口中并没有报错 其中有人说是路由等问题,后来通过创建新的项目对比配置文件信息,发现是配置信息导致: 注释部分是打包时需要修改的地方(根据打包时网站根目录,这个没处理好可能会出现图片路径加载失败问题),而上面才是在开发环境下需要的配置信息

  • 关于vue的npm run dev和npm run build的区别介绍

    关于vue的npm run dev和npm run build的区别介绍,下面就分享给大家,具体如下: ├─build │ ├─build.js │ ├─check-versions.js │ ├─dev-client.js │ ├─dev-server.js │ ├─utils.js │ ├─vue-loader.conf.js │ ├─webpack.base.conf.js │ ├─webpack.dev.conf.js │ ├─webpack.prod.conf.js │ └─webpa

  • 使用vue-cli初始化项目时运行‘npm run dev’报错及解决

    目录 vue-cli初始化项目时运行‘npm run dev’报错 vue-cli初始化项目时运行‘npm run dev’报错 npm run dev 无法启动 0 info it worked if it ends with ok1 verbose cli [1 verbose cli   'D:\\Program Files\\nodejs\\node.exe',1 verbose cli   'D:\\Program Files\\nodejs\\node_modules\\npm\\b

  • 解决vue项目运行npm run serve报错的问题

    先来一张报错的截图 先去配置环境变量 C:\Users\lgd\AppData\Local\Programs\Microsoft VS Code\bin的后面配置 :%SystemRoot%\system32;一定要注意分号, 然后在path环境中配置C:\Windows\System32 最后去项目安装依赖 npm i 运行项目 npm run serve 如果这样子项目还是报同样的错误,那么就把node全局卸载,去控制面板卸载,然后安装,最后安装依赖,运行项目就可以成功了 补充知识:vue

  • vue-cli创建项目时由esLint校验导致报错或警告的问题及解决

    目录 vue-cli创建项目时由esLint校验导致报错或警告 eslint语法限制项目报错解决 vue-cli创建项目时由esLint校验导致报错或警告 vue-cli创建项目后编写代码控制台一片黄 但不影响代码执行 但是看着就是很不爽啊 到网上搜索了一下这个问题,想起来初始化项目时安装了esLint校验工具 嗯,我看到了很多办法都是下面这样的 1.因为你设置了eslint,如果你不想有规范的js代码,可以重新初始化关掉eslint. Use ESLint to lint your code?

  • window环境下npm install node-sass报错的解决方法

    最近准备想用vue-cli初始化一个项目,需要sass-loader编译: 发现window下npm install node-sass和sass-loader一直报错, window 命令行中提示我全局安装 node-gyp ,有些提示好像是本地找不到python, 于是我按照提示安装node-gyp node-gyp是一个用Node.js编写的跨平台命令行工具,用于编译Node.js的本地插件模块. node-gyp node-gyp官方网址  https://www.npmjs.com/p

  • idea springBoot项目自动注入mapper为空报错的解决方法

    在SpringBoot项目中,如果使用了MyBatis作为持久层框架,使用自动注入时可能会遇到mapper报空指针异常的问题.这是因为在自动注入时,SpringBoot无法正确识别MyBatis的Mapper接口,需要进行一些额外的配置.解决这个问题的方法有两种: 1.在Mapper接口上添加注解在Mapper接口上添加@Mapper注解,告诉SpringBoot这个接口是一个Mapper接口,需要进行代理.示例如下: @Mapper public interface UserMapper {

  • json解析时遇到英文双引号报错的解决方法

    有时解析json时,会碰到里面带有英文的双引号,导致解析错误,可以将json进行转义,一下: public static String htmlEscape(String input) { if(isEmpty(input)){ return input; } input = input.replaceAll("&", "&"); input = input.replaceAll("<", "<")

  • Mybatis Plus查询时sql字段名大小写报错的解决

    目录 Mybatis Plus查询时sql字段名大小写报错 遇到报错 错误解析 解决方案 Mybatis Plus返回map大小写问题 Mybatis Plus查询时sql字段名大小写报错 遇到报错 错误解析 在数据库中没有找到img_url 列 数据库字段名是是大写 解决方案 在application.properties中加: mybatis-plus.configuration.map-underscore-to-camel-case=false 完美运行~ Mybatis Plus返回m

  • springboot新建项目pom.xml文件第一行报错的解决

    目录 springboot新建项目pom.xml文件第一行报错 新建一个测试项目 下面是文件 解决这个问题只需要 springboot创建过程中pom.xml报错 问题出现原因 解决办法 springboot新建项目pom.xml文件第一行报错 新建一个测试项目 发现创建完毕pom.xml文件报错,提示 Description Resource Path Location Type Unknown pom.xml /demo line 1 Maven Configuration Problem

随机推荐