如何在sublime中创建一个构建系统,以便windows运行npm?

时间:2017-01-12 13:54:34

标签: cmd npm sublimetext3

Cmd正常

$ npm test

输出: '你好'

Sublime构建不起作用

见下文:

我目前保存了我的项目:

myproject.sublime项目

{
    "folders" :
    [
        {
            "path": "C:\\projects\\myproject"
        }
    ],
    "build_systems" : [{
        "name":"npm",
        "working_dir":"${project_path}",
        "shell_cmd":"npm test",     
        "windows" : {
            "shell": true
        }       
    }]
}

C:\项目\ myproject的\的package.json

{
  "name": "myproject",
  "version": "1.0.0",
  "description": "Demo example",
  "scripts": {
    "test": "echo 'hello'"
  },
  "license": "ISC",
}

构建类型: 我已经正确选择了 - ' npm'作为我在构建系统中的构建。

当我运行build时,看起来该命令正在试图从我的漫游文件夹中加载package.json。

错误如下:

npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "test"
npm ERR! node v6.9.1
npm ERR! npm  v3.10.8
npm ERR! path C:\Users\me\AppData\Roaming\Sublime Text 3\Packages\User\package.json
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall open

npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\me\AppData\Roaming\Sublime Text 3\Packages\User\package.json'
npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\me\AppData\Roaming\Sublime Text 3\Packages\User\package.json'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\me\AppData\Roaming\Sublime Text 3\Packages\User\npm-debug.log
[Finished in 1.5s]

0 个答案:

没有答案