Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
552 views
in Technique[技术] by (71.8m points)

node.js - 无法获取Vue CLI 4查找依赖项(Can't get vue cli 4 to find dependencies)

So I installed vue cli 4.1.1 to get a new project going.

(因此,我安装了vue cli 4.1.1来进行新项目。)

I select manual setup so I can pick what I need.

(我选择手动设置,以便可以选择所需的东西。)

But when I try to run "npm run serve" I get the following error:

(但是,当我尝试运行“ npm run serve”时,出现以下错误:)

ERROR Failed to compile with 4 errors 10:59:53 These dependencies were not found: * @/components/HelloWorld.vue in C:/Program Files/nodejs/node_modules/@vue/cli-service-global/node_modules/babel-loader/lib??ref--12-0!C:/Program Files/nodejs/node_modules/@vue/cli-service-global/node_modules/cache-loader/dist/cjs.js??ref--0-0!C:/Program Files/nodejs/node_modules/@vue/cli-service-global/node_modules/vue-loader/lib??vue-loader-options!./views/Home.vue?vue&type=script&lang=js& * register-service-worker in ./registerServiceWorker.js * vue-router in ./router/index.js * vuex in ./store/index.js To install them, you can run: npm install --save @/components/HelloWorld.vue register-service-worker vue-router vuex

All the files are at the right place.

(所有文件都在正确的位置。)

I havn't done anything to the project besides removing node_modules and reinstalling it with "npm install".

(除了删除node_modules并使用“ npm install”重新安装之外,我对项目没有任何处理。)

(Had to do this to get rid of another error)

((这样做是为了摆脱另一个错误))

I am runnig Windows 10, Node 10.15.1, NPM 5.0.4 and vue-cli 4.1.1

(我正在运行Windows 10,Node 10.15.1,NPM 5.0.4和vue-cli 4.1.1)

What troubles me the most is that it's just regular vue files and not packages.

(最让我困扰的是,这只是常规的Vue文件而不是软件包。)

Why it suggests that I should install them with npm install is something I find odd.

(为什么我建议我使用npm install安装它们,这使我感到有些奇怪。)

  ask by Rarex translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

选择手动选项时,必须在components目录名称中创建一个文件HelloWorld.vue在执行上述步骤后,请运行npm install --save register-service-worker vue-router vuex


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...