Javascript 节点_ENV此时出现意外错误
我在youtube上关注本教程,因为我试图学习node.js/express 为了能够使用nodemon,我在package.json文件中更改了以下内容 package.jsonJavascript 节点_ENV此时出现意外错误,javascript,node.js,json,express,Javascript,Node.js,Json,Express,我在youtube上关注本教程,因为我试图学习node.js/express 为了能够使用nodemon,我在package.json文件中更改了以下内容 package.json "scripts": { "start": "if [[ $NODE_ENV == 'production' ]]; then node ./bin/www; else nodemon ./bin/www; fi" }, 但是,当我在cmd提示符下运行以下命令时,我得到一个错误 set DEBUG=
"scripts": {
"start": "if [[ $NODE_ENV == 'production' ]]; then node ./bin/www; else nodemon ./bin/www; fi"
},
但是,当我在cmd提示符下运行以下命令时,我得到一个错误
set DEBUG=myapp:* & npm start
以下错误:
$NODE_ENV was unexpected at this time.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! myapp@0.0.0 start: `if [[ $NODE_ENV == 'production' ]]; then node ./bin/www; else nodemon ./bin/www; fi`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the myapp@0.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
- 我已经尝试过更新所有npm模块。 -我尝试过删除package-lock.json并重新安装所有内容
现在运行nodemon或npm start我试着在全局范围内安装nodemon,结果成功了
npm安装-g nodemon
并使用
nodemon
启动应用程序我收到了相同的错误,但我将其更改为:
"scripts": {
"start": "node ./bin/www",
"dev": "nodemon ./bin/www"
},
我用“纱线开发”和“npm运行开发”来实现npm。如果你只想运行nodemon,你可以这样做
"start" : "nodemon ./bin/www"
就这些。您已准备就绪您的shell需要能够解释该语法。这不是安装问题,而是shell语法错误。就像我在Ubuntu上尝试使用
rmdir/S/qwww
,它会失败
"start" : "nodemon ./bin/www"