赞
踩
ERROR in ./src/index.js Module build failed (from ./node_modules/_babel-loader@8.1.0@babel-loader/lib/index.js): Error: Cannot find module '@babel/core' Require stack: - D:\work\HBuilderXWorkspace\react\01.webpack-base\node_modules\_babel-loader@8.1.0@babel-loader\lib\index.js - D:\work\HBuilderXWorkspace\react\01.webpack-base\node_modules\loader-runner\lib\loadLoader.js - D:\work\HBuilderXWorkspace\react\01.webpack-base\node_modules\loader-runner\lib\LoaderRunner.js - D:\work\HBuilderXWorkspace\react\01.webpack-base\node_modules\webpack\lib\NormalModule.js - D:\work\HBuilderXWorkspace\react\01.webpack-base\node_modules\webpack\lib\NormalModuleFactory.js - D:\work\HBuilderXWorkspace\react\01.webpack-base\node_modules\webpack\lib\Compiler.js - D:\work\HBuilderXWorkspace\react\01.webpack-base\node_modules\webpack\lib\webpack.js - D:\work\HBuilderXWorkspace\react\01.webpack-base\node_modules\_webpack-dev-server@3.11.0@webpack-dev-server\bin\webpac k-dev-server.js babel-loader@8 requires Babel 7.x (the package '@babel/core'). If you'd like to use Babel 6.x ('babel-core'), you shoul d install 'babel-loader@7'. at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15) at Function.Module._load (internal/modules/cjs/loader.js:842:27) at Module.require (internal/modules/cjs/loader.js:1026:19) at require (internal/modules/cjs/helpers.js:72:18) at Object.<anonymous> (D:\work\HBuilderXWorkspace\react\01.webpack-base\node_modules\_babel-loader@8.1.0@babel-loade r\lib\index.js:10:11) 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)
babel-loader@8 requires Babel 7.x (the package '@babel/core'). If you'd like to use Babel 6.x ('babel-core'), you shoul d install 'babel-loader@7'.
Emmmm…应该是版本问题,那就去package.json里面改版本号好了。
"devDependencies": {
"babel-core": "^6.26.3",
"babel-loader": "^7.1.5",
},
改完来,加载一下package.json的包,执行cnpm install
或者npm install
嗯,,
使用环境:
dependencies:生产环境下所依赖的 npm 包集合;
devDependencies:开发和测试环境下所依赖的 npm 包集合;
单个包安装方式:
dependencies:
# 在与 package.json 同级目录下执行
# —sava-prod 为默认安装模式
# 安装以后会自动在 package.json 的 dependencies 下添加 <package-name>
npm install <package-name> [—sava-prod]
devDependencies:
# 在与 package.json 同级目录下执行
# 安装以后会自动在 package.json 的 devDependencies 下添加 <package-name>
npm install <package-name> —sava-dev
集成安装方式:
dependencies:
# 在与 package.json 同级目录下执行
# 安装 dependencies 和 devDependencies 中的所有 npm 包
npm install
# 仅安装 dependencies 下的所有 npm 包
npm install —production
devDependencies:
# 在与 package.json 同级目录下执行
# 安装 dependencies 和 devDependencies 中的所有 npm 包
npm install
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。