Как запустить скрипт в скобках с расширением package.json?
Я хочу запустить скрипт в менеджере расширений Brackets при установке моего расширения.
Нашел этот код в расширении по умолчанию в скобках '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
как использовать узел без установки nodejs в расширении Brackets установить?
1 ответ
Это не имеет ничего общего с скобками, вам нужно обновить путь файловой системы, чтобы включить узел
Вам нужно добавить место, где вы установили nodeJS что-то вроде (C:\Program Files\nodejs
) к вашей переменной окружения PATH. Для этого выполните следующие действия:
- Используйте глобальный шарм поиска для поиска "Переменные среды"
- Нажмите "Изменить системные переменные среды"
- Нажмите "Переменные среды" в диалоговом окне.
- В поле "Системные переменные" найдите "Путь" и отредактируйте его, чтобы включить
C:\Program Files\nodejs
, Убедитесь, что он отделен от любых других путей;
,
Вам придется перезапустить все открытые в настоящий момент командные строки, прежде чем они вступят в силу.