繁体   English   中英

如何在括号扩展package.json中运行脚本?

[英]how to run script in brackets extension package.json?

安装扩展程序时,我想在Brackets Extension Manager中运行脚本。

在方括号默认扩展名“ JavaScriptCodeHints”中找到了此代码。

{
  "name": "brackets-javascript-code-hints",
  "dependencies": {
    "acorn": "3.3.0",
    "tern": "0.20.0"
},
  "scripts": {
    "postinstall": "node ./fix-acorn"
  }
}

同样使用“ postinstall”:“ node ./test”,但显示此错误消息。

npm-stderr: sh: node: command not found

npm WARN testExtensionInstaller@1.0.1 No description
npm WARN testExtensionInstaller@1.0.1 No repository field.
npm WARN testExtensionInstaller@1.0.1 No license field.
npm ERR! Darwin 16.7.0
npm ERR! argv "/Applications/Brackets.app/Contents/MacOS/Brackets-node" "/Applications/Brackets.app/Contents/www/node_modules/npm/bin/npm-cli.js" "install" "--production"
npm ERR! node v6.3.1
npm ERR! npm  v3.10.9
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! testExtensionInstaller@1.0.1 postinstall: `node ./test`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the testExtensionInstaller@1.0.1 postinstall script 'node ./test'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the testExtensionInstaller package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node ./test
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs testExtensionInstaller
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls testExtensionInstaller
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /private/var/folders/1y/bd63w8h51wzccq_zbw6804440000gn/T/bracketsPackage_117723-46419-zgk6x5.ki3sicc8fr/testExtensionInstaller/npm-debug.log

如何在Brackets扩展安装中使用没有安装nodejs的节点?

这与方括号无关,您需要更新文件系统路径以包含节点

您需要将安装nodeJS之类的位置( C:\\Program Files\\nodejs )添加到PATH环境变量中。 为此,请按照下列步骤操作:

  1. 使用全局搜索超级按钮搜索“环境变量”
  2. 点击“编辑系统环境变量”
  3. 在对话框中单击“环境变量”。
  4. 在“系统变量”框中,搜索Path并将其编辑为包括C:\\Program Files\\nodejs 确保将其与其他路径分开;

您必须重新启动任何当前打开的命令提示符才能生效。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM