2017-10-18 1 views
0

json npm 패키지를 사용하여 package.json 파일을 업데이트하고 있습니다. '-'문자 문제를 만드는 경우 가져 오기 오류 메시지 필드 이름이 포함되어있는 경우가 있음을json nmp 패키지가 작동하지 않습니다.

undefined:2 
this.dependencies.'data-version'="1.0.0.1" 
        ^^^^^^^^^^ 

SyntaxError: Unexpected string 
    at new Function (<anonymous>) 
    at main (C:\Users\SEUser2\AppData\Roaming\npm\node_modules\json\lib\json.js: 
1289:27) 
    at Object.<anonymous> (C:\Users\SEUser2\AppData\Roaming\npm\node_modules\jso 
n\lib\json.js:1683:5) 
    at Module._compile (module.js:569:30) 
    at Object.Module._extensions..js (module.js:580:10) 
    at Module.load (module.js:503:32) 
    at tryModuleLoad (module.js:466:12) 
    at Function.Module._load (module.js:458:3) 
    at Function.Module.runMain (module.js:605:10) 
    at startup (bootstrap_node.js:158:16) 

I 관찰자 다음

사용하여 다음 명령

json -f package.json -I -e this.dependencies.data-version=\"1.0.0.1\" 

.

'-'문자를 이스케이프하는 위 명령을 실행하는 방법은 무엇입니까? JSON -f package.json -I -e this.dependencies [ '데이터 버전 = \ "1.0 :

답변

0

는 대신

+0

내가 이것을 시도 ['데이터 = 버전 '] this.dependencies를 사용하여 시도 할 수 있습니다. 0.1 \ " ']. 작동하지 않습니다. – Wrox

관련 문제