良い一日:バベルプリセットENVは発行
私はちょうどNPMを通じてバベルプリセット-ENVをインストールして、この問題を得る:
{
"name": "api",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "nodemon -L server.js --ignore 'db/schema.json' --exec babel-node server.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"@babel/core": "^7.0.0-beta.32",
"@babel/preset-env": "^7.0.0-beta.32",
"babel-core": "^6.26.0",
"express": "^4.16.2",
"express-graphql": "^0.6.11",
"express-oauth-server": "^2.0.0",
"graphql": "^0.11.7",
"jsonwebtoken": "^8.1.0",
"mongo": "^0.1.0",
"mongoose": "^4.13.2",
"password-hash": "^1.2.2",
"react-relay": "^1.4.1"
},
"devDependencies": {
"babel-cli": "^6.26.0"
}
}
:
[nodemon] starting `babel-node server.js server.js`
/home/vagrant/api/node_modules/babel-core/lib/transformation/file/options/option-manager.js:328
throw e;
^
TypeError: Cannot read property 'loose' of undefined (While processing preset: "/home/vagrant/api/node_modules/@babel/preset-env/lib/index.js")
at _default (/home/vagrant/api/node_modules/@babel/plugin-transform-modules-commonjs/lib/index.js:19:22)
at Function.memoisePluginContainer (/home/vagrant/api/node_modules/babel-core/lib/transformation/file/options/option-manager.js:113:13)
at Function.normalisePlugin (/home/vagrant/api/node_modules/babel-core/lib/transformation/file/options/option-manager.js:146:32)
at /home/vagrant/api/node_modules/babel-core/lib/transformation/file/options/option-manager.js:184:30
at Array.map (native)
at Function.normalisePlugins (/home/vagrant/api/node_modules/babel-core/lib/transformation/file/options/option-manager.js:158:20)
at OptionManager.mergeOptions (/home/vagrant/api/node_modules/babel-core/lib/transformation/file/options/option-manager.js:234:36)
at /home/vagrant/api/node_modules/babel-core/lib/transformation/file/options/option-manager.js:265:14
at /home/vagrant/api/node_modules/babel-core/lib/transformation/file/options/option-manager.js:323:22
at Array.map (native)
私Package.JSONは以下のとおりです。
[email protected]:~/api$ cat .babelrc
{
"presets": [
["@babel/preset-env", {
"targets": {
"node": "current"
}
}]
]
}
:
そしてまた私の.babelrcはこれです
アップグレードの前に私はstage-0
とes2015
プリセットを使用していましたが、アップグレード後にバグがありました。 NPMのバージョンは4.6.1
です。
ありがとうございました。