Baqend 样板无法 npm 运行 构建
Baqend boilerplate fails to npm run build
我正在测试从 https://www.baqend.com/guide/starter-kits/react/ 下载的 Baqend 样板,当执行 npm 运行 构建时,它会抛出此错误:
Creating an optimized production build...
Failed to compile.
Failed to minify the code from this file:
./node_modules/baqend/lib/util/Metadata.js:12
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! react-redux-starter@0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react-redux-starter@0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
希望我只是使用旧版本的 SDK?
这在本地主机上非常有效!
打包文件:
{
"name": "Nurse Uber Web",
"version": "0.1.0",
"private": true,
"dependencies": {
"baqend": "^2.8.6",
"lodash": "^4.17.4",
"prop-types": "^15.5.9",
"react": "^15.6.1",
"react-bootstrap": "^0.31.3",
"react-dom": "^15.6.1",
"react-redux": "^5.0.6",
"react-router": "^4.1.2",
"react-router-dom": "^4.1.2",
"redux": "^3.7.2",
"redux-baqend": "^1.0.4",
"redux-logger": "^3.0.6",
"redux-thunk": "^2.2.0"
},
"devDependencies": {
"react-scripts": "^1.0.11"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom"
}
}
根据此 link,直接导入库源被认为是不好的做法。您可以通过简单地导入编译后的版本来避免这个问题。只需将所有应用程序源中的 import { db } from 'baqend/lib/baqend'
更改为 import { db } from 'baqend'
(启动程序中的 store.js
和 Messages.js
),它应该可以工作。感谢您指出这一点。
我正在测试从 https://www.baqend.com/guide/starter-kits/react/ 下载的 Baqend 样板,当执行 npm 运行 构建时,它会抛出此错误:
Creating an optimized production build...
Failed to compile.
Failed to minify the code from this file:
./node_modules/baqend/lib/util/Metadata.js:12
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! react-redux-starter@0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react-redux-starter@0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
希望我只是使用旧版本的 SDK?
这在本地主机上非常有效!
打包文件:
{
"name": "Nurse Uber Web",
"version": "0.1.0",
"private": true,
"dependencies": {
"baqend": "^2.8.6",
"lodash": "^4.17.4",
"prop-types": "^15.5.9",
"react": "^15.6.1",
"react-bootstrap": "^0.31.3",
"react-dom": "^15.6.1",
"react-redux": "^5.0.6",
"react-router": "^4.1.2",
"react-router-dom": "^4.1.2",
"redux": "^3.7.2",
"redux-baqend": "^1.0.4",
"redux-logger": "^3.0.6",
"redux-thunk": "^2.2.0"
},
"devDependencies": {
"react-scripts": "^1.0.11"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom"
}
}
根据此 link,直接导入库源被认为是不好的做法。您可以通过简单地导入编译后的版本来避免这个问题。只需将所有应用程序源中的 import { db } from 'baqend/lib/baqend'
更改为 import { db } from 'baqend'
(启动程序中的 store.js
和 Messages.js
),它应该可以工作。感谢您指出这一点。