Малина и нодер - nodejs - npm SyntaxError - PullRequest
1 голос
/ 09 февраля 2020

Я пытаюсь установить сенсорный узел в nodered для моего raspberry pi3. Датчик является датчиком качества воздуха SDS011, и команда для его установки следующая:

npm install node-red-contrib-sds011

все в порядке, я думаю, что это проблема с некоторыми обновлениями, на самом деле команда

node -v

дает мне "v4.4.5" в качестве ответа.

Проблема в том, что, когда я пытаюсь использовать некоторые npm команды, как указано выше для датчика, я всегда получаю эту ошибку в качестве ответа:

SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:373:25)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Function.Module.runMain (module.js:441:10)
    at startup (node.js:139:18)
    at node.js:968:3

Кроме того, если я пытаюсь запустить консоль node.red, появляется похожая ошибка:

Starting as a systemd service.                                                                            
/usr/lib/node_modules/node-red/node_modules/fs-extra/lib/fs/index.js:93                                   
exports.write = function (fd, buffer, ...args) {                                                          
                                      ^^^                                                                 
SyntaxError: Unexpected token ...                                                                         
    at exports.runInThisContext (vm.js:53:16)                                                             
    at Module._compile (module.js:373:25)                                                                 
    at Object.Module._extensions..js (module.js:416:10)                                                   
    at Module.load (module.js:343:32)                                                                     
    at Function.Module._load (module.js:300:12)                                                           
    at Module.require (module.js:353:17)                                                                  
    at require (internal/module.js:12:17)                                                                 
    at Object.<anonymous> (/usr/lib/node_modules/node-red/node_modules/fs-extra/                          lib/index.js:6:3)                                                                                         
    at Module._compile (module.js:409:26)                                                                 
    at Object.Module._extensions..js (module.js:416:10)                                                   
nodered.service: Main process exited, code=exited, status=1/FAILURE                                       
nodered.service: Failed with result 'exit-code'.                                                          
nodered.service: Service RestartSec=100ms expired, scheduling restart.                                    
nodered.service: Scheduled restart job, restart counter is at 1.                                          
Stopped Node-RED graphical event wiring tool.                                                             
Started Node-RED graphical event wiring tool.                                                             
/usr/lib/node_modules/node-red/node_modules/fs-extra/lib/fs/index.js:93                                   
exports.write = function (fd, buffer, ...args) {                                                          
                                      ^^^                                                                 
SyntaxError: Unexpected token ...                                                                         
    at exports.runInThisContext (vm.js:53:16)                                                             
    at Module._compile (module.js:373:25)                                                                 
    at Object.Module._extensions..js (module.js:416:10)                                                   
    at Module.load (module.js:343:32)                                                                     
    at Function.Module._load (module.js:300:12)                                                           
    at Module.require (module.js:353:17)                                                                  
    at require (internal/module.js:12:17)                                                                 
    at Object.<anonymous> (/usr/lib/node_modules/node-red/node_modules/fs-extra/                          lib/index.js:6:3)                                                                                         
    at Module._compile (module.js:409:26)                                                                 
    at Object.Module._extensions..js (module.js:416:10)                                                   
nodered.service: Main process exited, code=exited, status=1/FAILURE                                       
nodered.service: Failed with result 'exit-code'.                                                          
nodered.service: Service RestartSec=100ms expired, scheduling restart.                                    
nodered.service: Scheduled restart job, restart counter is at 2.                                          
Stopped Node-RED graphical event wiring tool.                                                             
Started Node-RED graphical event wiring tool.                                                             
/usr/lib/node_modules/node-red/node_modules/fs-extra/lib/fs/index.js:93                                   
exports.write = function (fd, buffer, ...args) {                                                          
                                      ^^^                                                                 
SyntaxError: Unexpected token ...                                                                         
    at exports.runInThisContext (vm.js:53:16)                                                             
    at Module._compile (module.js:373:25)                                                                 
    at Object.Module._extensions..js (module.js:416:10)                                                   
    at Module.load (module.js:343:32)                                                                     
    at Function.Module._load (module.js:300:12)                                                           
    at Module.require (module.js:353:17)                                                                  
    at require (internal/module.js:12:17)                                                                 
    at Object.<anonymous> (/usr/lib/node_modules/node-red/node_modules/fs-extra/                          lib/index.js:6:3)                                                                                         
    at Module._compile (module.js:409:26)                                                                 
    at Object.Module._extensions..js (module.js:416:10)                                                   
nodered.service: Main process exited, code=exited, status=1/FAILURE                                       
nodered.service: Failed with result 'exit-code'.                                                          
nodered.service: Service RestartSec=100ms expired, scheduling restart.                                    
nodered.service: Scheduled restart job, restart counter is at 3.                                          
Stopped Node-RED graphical event wiring tool.                                                             
Started Node-RED graphical event wiring tool.                                                             
/usr/lib/node_modules/node-red/node_modules/fs-extra/lib/fs/index.js:93                                   
exports.write = function (fd, buffer, ...args) {                                                          
                                      ^^^                                                                 
SyntaxError: Unexpected token ...                                                                         
    at exports.runInThisContext (vm.js:53:16)                                                             
    at Module._compile (module.js:373:25)                                                                 
    at Object.Module._extensions..js (module.js:416:10)                                                   
    at Module.load (module.js:343:32)                                                                     
    at Function.Module._load (module.js:300:12)                                                           
    at Module.require (module.js:353:17)                                                                  
    at require (internal/module.js:12:17)                                                                 
    at Object.<anonymous> (/usr/lib/node_modules/node-red/node_modules/fs-extra/                          lib/index.js:6:3)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
nodered.service: Main process exited, code=exited, status=1/FAILURE
nodered.service: Failed with result 'exit-code'.
nodered.service: Service RestartSec=100ms expired, scheduling restart.
nodered.service: Scheduled restart job, restart counter is at 4.
Stopped Node-RED graphical event wiring tool.
Started Node-RED graphical event wiring tool.
/usr/lib/node_modules/node-red/node_modules/fs-extra/lib/fs/index.js:93
exports.write = function (fd, buffer, ...args) {
                                      ^^^
SyntaxError: Unexpected token ...
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:373:25)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/usr/lib/node_modules/node-red/node_modules/fs-extra/lib/index.js:6:3)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
nodered.service: Main process exited, code=exited, status=1/FAILURE
nodered.service: Failed with result 'exit-code'.
nodered.service: Service RestartSec=100ms expired, scheduling restart.
nodered.service: Scheduled restart job, restart counter is at 5.
Stopped Node-RED graphical event wiring tool.
nodered.service: Start request repeated too quickly.
nodered.service: Failed with result 'exit-code'.
Failed to start Node-RED graphical event wiring tool.

некоторые предложения?

большое спасибо.

1 Ответ

0 голосов
/ 09 февраля 2020

NodeJS v4.4.5 ОЧЕНЬ стар и полностью лишен поддержки (EOL вышел в апреле 2018 года).

В настоящее время Node-RED требуется как минимум NodeJS версия 8.x () https://nodered.org/docs/faq/node-versions)

Вам необходимо обновить систему, я предлагаю вам использовать скрипт, связанный с здесь , так как он обновится до последней версии NodeJS и Node- RED.

...