在Windows 10上苦苦掙扎Laravel 5.4 vagrant box,試圖讓laravel-mix工作。我的最終目標是爲PWA(Progressive Web App)設置ServiceWorker和資產緩存,並且必須承認node,npm,mix/gulp令我困惑。從我在論壇帖子中看到的情況來看,它是相當脆弱的技術,容易因爲環境的任何微小變化或變化而中斷。在laravel homestead上運行「npm run dev」時出現錯誤(es2015未找到)
Module build failed: Error: Couldn't find preset "es2015" relative to directory "/home/vagrant"
at /home/vagrant/Code/laravel-basics/node_modules/babel-core/lib/transformation/file/options/option-manager.js:293:19
這裏是我的package.json:
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"development2": "./node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"axios": "^0.16.2",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-stage-2": "^6.24.1",
"bootstrap-sass": "^3.3.7",
"cross-env": "^5.0.5",
"font-awesome": "^4.7.0",
"jquery": "^3.1.1",
"laravel-mix": "^1.4.2",
"lodash": "^4.17.4",
"node-sass": "^4.5.3",
"sw-precache-webpack-plugin": "^0.11.4",
"vue": "^2.1.10",
"webpack-rtl-plugin": "^1.5.0"
}
}
最新
我跑 「故宮運行開發」(一次爲每個編譯js的資源)時收到此錯誤信息4倍嘗試在執行「rm -rf node_modules & & npm install」(或其等價物)之前從管理員命令提示符運行vagrant。我不喜歡這樣,但npm安裝比「--no-bin-links」選項更流暢。我也試過紗線而不是npm安裝。
啊是的。我也這樣做了,但忘了它。我想重新啓動會話(膩子或其他)就足夠了,而不是重新加載整個虛擬機。 – flap152