在全新的Vue-CLI生成的项目上运行npm run serve时出错

时间:2020-07-07 01:15:59

标签: node.js vue.js npm vue-cli-4

我一直试图在使用Vue CLI生成的新vue项目上运行npm run serve。 我只是使用vue create app创建项目,然后将目录更改为项目本身cd app并运行npm run serve,这是我之前在其他项目中所做的,但是从昨天开始,我一直遇到此错误: 我收到此错误:

INFO  Starting development server...
ERROR  Error: No valid exports main found for 'D:\Documents\app\node_modules\colorette'
Error: No valid exports main found for 'D:\Documents\app\node_modules\colorette'
at resolveExportsTarget (internal/modules/cjs/loader.js:618:9)
at applyExports (internal/modules/cjs/loader.js:499:14)
at resolveExports (internal/modules/cjs/loader.js:548:12)
at Function.Module._findPath (internal/modules/cjs/loader.js:650:22)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:948:27)
at Function.Module._load (internal/modules/cjs/loader.js:854:27)
at Module.require (internal/modules/cjs/loader.js:1023:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> 
(D:\Documents\app\node_modules\autoprefixer\lib\autoprefixer.js:5:17)
at Module._compile (internal/modules/cjs/loader.js:1128:30)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! frontend@0.1.0 serve: `vue-cli-service serve`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the frontend@0.1.0 serve 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\acamp\AppData\Roaming\npm-cache\_logs\2020-07-07T01_02_53_207Z-debug.log

我已经尝试删除node_modules,然后再运行npm i,但是并不能解决问题。还尝试将vue CLI更新到最新版本npm i @vue/cli,但也无济于事。

在我创建的所有新项目中都会发生这种情况 请帮忙!

1 个答案:

答案 0 :(得分:-1)

请将您的node-js更新为v14.x.x