我无法在开发人员的机器上进行资产编译工作。这是一些规格:
1 Laravel 5.3
2 package.json:
{
"private": true,
"scripts": {
"prod": "gulp --production",
"dev": "gulp watch",
"build": "gulp"
},
"devDependencies": {
"bootstrap-sass": "^3.3.7",
"del": "^2.2.2",
"eslint": "^4.12.1",
"eslint-config-standard": "^10.2.1",
"eslint-plugin-promise": "^3.6.0",
"eslint-plugin-standard": "^3.0.1",
"eslint-plugin-vue": "^4.0.0-beta.2",
"gentelella": "^1.3.0",
"gulp": "^3.9.1",
"jquery": "^3.2.1",
"laravel-echo": "^1.3.0",
"laravel-elixir": "^6.0.0-15",
"laravel-elixir-vue-2": "^0.3.0",
"laravel-elixir-webpack-official": "^1.0.10",
"laravel-elixir-webpack-react": "^1.0.1",
"laravel-vue-pagination": "^1.2.0",
"lodash": "^4.17.4",
"moment": "^2.18.1",
"portal-vue": "^1.3.0",
"pusher-js": "^4.1.0",
"vue": "^2.4.1",
"vue-resource": "^1.3.4",
"vuedraggable": "^2.14.1"
},
"dependencies": {}
}
3我的操作系统:Mac OS X High Sierra。
4 Dev的操作系统:Debian 9
5我们都安装了相同的节点和npm版本。
6我可以同时做npm install
和npm run dev
。
7开发者只能执行npm install
。第二条命令会产生如下错误:
Error: ./resources/assets/js/app.js
Module build failed: TypeError: fileSystem.statSync is not a function
at module.exports (/home/thedev/Work/lo/project/node_modules/babel-loader/lib/utils/exists.js:7:25)
at find (/home/thedev/Work/lo/project/node_modules/babel-loader/lib/resolve-rc.js:13:9)
8现在,有趣的部分。为了使其“相同”,我准备了一个docker映像。这是Dokerfile:
FROM node:alpine
RUN apk update && apk upgrade && \
apk add --no-cache bash git openssh
9构建/运行图像:
# Host OS:
cd /path/to/project && docker build -t mappanel-npm dev-assets
docker run -v "$PWD":/home/node/app --name=mappanel-npm -it mappanel-npm /bin/bash
# Inside the container:
cd /home/node/app/
rm -rf node_modules package-lock.json
npm install
npm run dev
结果:一切都对我有利(就像在主机上运行npm一样)。开发人员与以前有相同的错误!
[07:34:55] webpack is watching for changes
[07:34:55]
ERROR in ./resources/assets/js/test.js
Module build failed: TypeError: fileSystem.statSync is not a function
at module.exports (/home/node/app/node_modules/babel-loader/lib/utils/exists.js:7:25)
at find (/home/node/app/node_modules/babel-loader/lib/resolve-rc.js:13:9)
at Object.module.exports (/home/node/app/node_modules/babel-loader/lib/index.js:111:132)
怎么来?…:/