自从我开始写bash脚本以来,我一直对此感到困惑。
YARN=$(which yarn)
if [ -z "${YARN}" ]; then
npm install -g yarn &&
fi
上面给出了一个语法错误,但这不会:
if [ -z "${YARN}" ]; then
npm install -g yarn &&
echo "yarn installed"
fi
为什么会这样呢?
如果我们这样做,我们如何确保:
if [ -z "${YARN}" ]; then
我正在跟踪 (以获得cloudflare页面使用动物群db),但是当我到达章节并尝试运行wrangler dev (它将运行npm run build,然后运行worktop build index.js)时,我会得到错误消息sh: worktop: command not found。
我再次检查了我是否正确地执行了每一步,检查了worktop是否存在于node_modules目录中(确实如此),并尝试全局安装worktop (没有工作)。
我在这里错过了什么?
运行wrangler dev的全部输出
$ wrangler dev
Running npm run build
我删除了~/package.json,现在我尝试安装这个。第一步很好
# Install node and npm first (make sure npm --version > 2.0), then:
sudo npm install -g grunt-cli bower
但是下一步
# In the project folder:
cd omega-build
npm run deps # This runs npm install in every module.
npm run dev # This runs npm link to aid local development
我有一个shell脚本,在该脚本中,我正在使用npm安装nvm。因为在我安装nvm之后,它使用nvm install node -> nvm use <version>安装了npm。
在此之后,我得到了npm cache clean,它无法识别命令npm。,因为我知道,为了让节点在终端中工作,我们需要重新启动。但是我在shell中有即将发布的命令,bash无法停止,因此我会出错,因为我使用npm来安装其他软件工具。
错误是:npm command is not found。
Shell脚本
# This is for the running the project
#!/bi
我正在学习Vue JS。计划在其上开发应用程序。最初,我通过以下方式安装Vue
npm install vue-cli -g
但是一些好朋友告诉我,这是贬低的。它也在文档中。
但无法通过cmd安装Vue:
npm install -g @vue/cli
这会给我一个错误,因为:
npm ERR! Unexpected end of JSON input while parsing near '...version":"0.5.0","dev'
npm ERR! A complete log of this run can be found i
因此,您可以使用npm bin -g来生成npm安装的bin目录。有没有一种方法可以使用npm来运行该目录中的内容?一个明显的选项是$(npm bin -g)/installednodeprogram,但是我从外部程序(emacs)调用它,希望避免打开shell。另外,我可以从npm bin -g获得路径,然后连接程序名并执行各种检查,但我希望有一种更干净的方法,我找不到像npm run-binary installednodeprogram这样的方法。