gpt4 book ai didi

node.js - NodeJS 在 ./app/app.jsx 中启动错误模块构建失败 : ReferenceError: [BABEL]

转载 作者:太空宇宙 更新时间:2023-11-04 00:42:06 25 4
gpt4 key购买 nike

我是.net开发人员。以前的开发人员在一个项目中使用了nodeJS和react。我必须完成该项目。该项目使用nodeJS和reactJS。我在Windows 8中安装了NodeJS

我安装了软件包(npm install),它运行良好。但是现在我尝试运行启动项目(npm start),但它给出了有关 babel 的错误。

  C:\rc>npm start

> react-seed@0.0.13 prestart C:\rc
> npm install

npm WARN package.json react-seed@0.0.13 No license field.

> node-sass@3.4.2 install C:\rc\node_modules\node-sass
> node scripts/install.js


> node-sass@3.4.2 postinstall C:\rc\node_modules\node-sass
> node scripts/build.js

` C:\rc\node_modules\node-sass\vendor\win32-x64-46\binding.node ` exists.
testing binary.
Binary is fine; exiting.
npm WARN unmet dependency C:\rc\node_modules\rimraf requires glob@'^7.0.0' but w
ill load
npm WARN unmet dependency C:\rc\node_modules\glob,
npm WARN unmet dependency which is version 5.0.15
npm WARN unmet dependency C:\rc\node_modules\babel-plugin-transform-decorators-l
egacy requires babel-runtime@'^6.2.0' but will load
npm WARN unmet dependency C:\rc\node_modules\babel-runtime,
npm WARN unmet dependency which is version 5.8.38
npm WARN unmet dependency C:\rc\node_modules\babel-preset-es2015\node_modules\ba
bel-plugin-transform-regenerator requires babel-core@'^6.6.5' but will load
npm WARN unmet dependency C:\rc\node_modules\babel-core,
npm WARN unmet dependency which is version 5.8.38
npm WARN unmet dependency C:\rc\node_modules\karma-mocha-reporter\node_modules\k
arma requires glob@'^7.0.0' but will load
npm WARN unmet dependency C:\rc\node_modules\glob,
npm WARN unmet dependency which is version 5.0.15

> react-seed@0.0.13 start C:\rc
> set NODE_ENV=development && node dev-server ./webpack/config

Listening at http://0.0.0.0:8000
Hash: dfc04e15fb6c36f0d4eb
Version: webpack 1.12.14
Time: 812ms
Asset Size Chunks Chunk Names
vendor.bundle.js 839 bytes 0 vendor
js\app.0.0.13.js 102 bytes 1 app
chunk {0} vendor.bundle.js (vendor) 28 bytes [rendered]
[0] multi vendor 28 bytes {0} [built] [1 error]
chunk {1} js\app.0.0.13.js (app) 28 bytes {0} [rendered]
[0] multi app 28 bytes {1} [built] [1 error]

ERROR in ./app/app.jsx
Module build failed: ReferenceError: [BABEL] C:\rc\app\app.jsx: Unknown option:
direct.presets
at Logger.error (C:\rc\node_modules\babel-core\lib\transformation\file\logge
r.js:58:11)
at OptionManager.mergeOptions (C:\rc\node_modules\babel-core\lib\transformat
ion\file\options\option-manager.js:126:29)
at OptionManager.init (C:\rc\node_modules\babel-core\lib\transformation\file
\options\option-manager.js:216:10)
at File.initOptions (C:\rc\node_modules\babel-core\lib\transformation\file\i
ndex.js:147:75)
at new File (C:\rc\node_modules\babel-core\lib\transformation\file\index.js:
137:22)
at Pipeline.transform (C:\rc\node_modules\babel-core\lib\transformation\pipe
line.js:164:16)
at transpile (C:\rc\node_modules\babel-loader\index.js:12:22)
at Object.module.exports (C:\rc\node_modules\babel-loader\index.js:71:12)
@ multi app

ERROR in ./app/vendor.js
Module build failed: ReferenceError: [BABEL] C:\rc\app\vendor.js: Unknown option
: direct.presets
at Logger.error (C:\rc\node_modules\babel-core\lib\transformation\file\logge
r.js:58:11)
at OptionManager.mergeOptions (C:\rc\node_modules\babel-core\lib\transformat
ion\file\options\option-manager.js:126:29)
at OptionManager.init (C:\rc\node_modules\babel-core\lib\transformation\file
\options\option-manager.js:216:10)
at File.initOptions (C:\rc\node_modules\babel-core\lib\transformation\file\i
ndex.js:147:75)
at new File (C:\rc\node_modules\babel-core\lib\transformation\file\index.js:
137:22)
at Pipeline.transform (C:\rc\node_modules\babel-core\lib\transformation\pipe
line.js:164:16)
at transpile (C:\rc\node_modules\babel-loader\index.js:12:22)
at Object.module.exports (C:\rc\node_modules\babel-loader\index.js:71:12)
@ multi vendor
webpack: bundle is now VALID.

这是我的 package.json

{
"name": "react-seed",
"version": "0.0.13",
"description": "Seed project for React apps using ES6 & webpack.",
"repository": "https://github.com/badsyntax/react-seed",
"config": {
"buildDir": "./build",
"buildDirTests": "./build_tests",
"devHost": "0.0.0.0",
"devPort": 8000,
"remoteHost": "https://mokey.gear.host"
},
"scripts": {
"build": "NODE_ENV=production npm run webpack",
"clean": "rimraf $npm_package_config_buildDir && mkdir $npm_package_config_buildDir",
"env": "env",
"lint": "eslint --ext .js --ext .jsx ./app ./webpack && echo No linting errors.",
"prebuild": "npm run clean",
"prestart": "npm install",
"pretest": "npm install && npm run lint",
"pretest-travis": "npm install && npm run lint",
"start": "set NODE_ENV=development && node dev-server ./webpack/config",
"test": "NODE_ENV=test karma start --single-run",
"test-dev": "NODE_ENV=test karma start",
"test-travis": "NODE_ENV=test karma start --single-run",
"webpack": "webpack --colors --progress --config ./webpack/config"
},
"dependencies": {
"classnames": "^2.1.1",
"hammerjs": "^2.0.4",
"immutable": "^3.7.6",
"intl": "^1.0.0",
"intl-locales-supported": "^1.0.0",
"jquery": "^2.1.4",
"lodash": "^4.6.1",
"materialize-css": "^0.97.5",
"ms-signalr-client": "^2.2.2",
"normalize.css": "^3.0.3",
"react": "^0.14.7",
"react-dnd": "^2.1.3",
"react-dnd-html5-backend": "^2.1.2",
"react-dom": "^0.14.7",
"react-flexgrid": "^0.7.0",
"react-intl": "^2.0.0-rc-1",
"react-redux": "^4.4.1",
"redux": "^3.3.1",
"redux-thunk": "^2.0.1",
"superagent": "^1.3.0"
},
"devDependencies": {
"autoprefixer-core": "^5.1.11",
"babel-core": "^5.3.3",
"babel-eslint": "^3.1.23",
"babel-loader": "^5.0.0",
"babel-plugin-rewire": "^0.1.8",
"babel-preset-react": "^6.5.0",
"babel-runtime": "^5.3.3",
"chai": "^2.3.0",
"compass-mixins": "^0.12.7",
"css-loader": "^0.12.1",
"eslint": "^0.21.0",
"eslint-plugin-react": "^2.3.0",
"expose-loader": "^0.7.0",
"extract-text-webpack-plugin": "^0.8.0",
"file-loader": "^0.8.1",
"glob": "^5.0.6",
"html-loader": "^0.3.0",
"json-loader": "^0.5.1",
"karma": "^0.12.31",
"karma-chrome-launcher": "^0.1.12",
"karma-cli": "0.0.4",
"karma-mocha": "^0.1.10",
"karma-mocha-reporter": "^1.0.2",
"karma-phantomjs-launcher": "^0.1.4",
"karma-sinon": "^1.0.4",
"karma-source-map-support": "^1.0.0",
"karma-sourcemap-loader": "^0.3.4",
"karma-webpack": "^1.5.1",
"mocha": "^2.2.4",
"mocha-loader": "^0.7.1",
"node-libs-browser": "^0.5.0",
"opn": "^1.0.2",
"postcss-loader": "^0.4.3",
"react-hot-loader": "^1.2.7",
"rimraf": "^2.3.3",
"sass-loader": "^0.4.2",
"sinon": "^1.14.1",
"source-map-support": "^0.2.10",
"style-loader": "^0.12.2",
"template-html-loader": "0.0.3",
"webpack": "^1.9.5",
"webpack-dev-server": "^1.8.2"
},
"engines": {
"node": ">=0.10.0"
},
"eslintConfig": {
"env": {
"browser": true,
"node": true,
"es6": true
},
"ecmaFeatures": {
"modules": true,
"jsx": true
},
"globals": {
"describe": true,
"it": true,
"xit": true,
"xdescribe": true,
"beforeEach": true,
"sinon": true
},
"plugins": [
"react"
],
"parser": "babel-eslint",
"rules": {
"strict": true,
"indent": [
2,
2
],
"quotes": [
2,
"single"
],
"new-cap": 0,
"no-unused-expressions": 0,
"no-underscore-dangle": 0,
"react/display-name": 0,
"react/jsx-quotes": 1,
"react/jsx-no-undef": 1,
"react/jsx-sort-props": 1,
"react/jsx-uses-react": 1,
"react/jsx-uses-vars": 1,
"react/no-did-mount-set-state": 1,
"react/no-did-update-set-state": 1,
"react/no-multi-comp": 1,
"react/no-unknown-property": 1,
"react/prop-types": 1,
"react/react-in-jsx-scope": 1,
"react/self-closing-comp": 1,
"react/wrap-multilines": 1
}
}
}

最佳答案

听起来你在某处(.babelrc?)有 Babel v6 的配置(例如 presets 选项),但你使用的是 Babel v5。

关于node.js - NodeJS 在 ./app/app.jsx 中启动错误模块构建失败 : ReferenceError: [BABEL],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36240377/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com