尝试使用Gatsby运行env.cmd,但我得到export PATH=$HOME/bin:/usr/local/bin:**$HOME/.npm/bin**:$PATH
。我确实已经安装了软件包。我尝试删除sh: env-cmd not found
并运行.node-modules
,但仍然遇到相同的错误。
gatsby-config.js:
npm install
端子:
{
...
"scripts": {
"build": "gatsby build",
"develop": "env-cmd --file .env.development --fallback gatsby develop",
"format": "prettier --write \"**/*.{js,jsx,json,md}\"",
"start": "npm run develop",
"serve": "gatsby serve",
"clean": "gatsby clean",
"test": "echo \"Write tests! -> https://gatsby.dev/unit-testing\" && exit 1"
},
"dependencies": {
"gatsby": "^2.18.12",
"gatsby-plugin-sass": "^2.1.26",
"node-sass": "^4.13.0",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"typescript": "^3.7.4"
},
"devDependencies": {
"env-cmd": "^8.0.2",
"prettier": "^1.19.1"
},
...
}
更新 对于遇到相同问题的其他人,这是我发现对我有用的解决方案:https://stackoverflow.com/a/56367980/10225590