Javascript 构建graphiql时出错
节点noob正在尝试运行graphiql项目。 根据本页上的说明: 运行了Javascript 构建graphiql时出错,javascript,babeljs,Javascript,Babeljs,节点noob正在尝试运行graphiql项目。 根据本页上的说明: 运行了npm运行构建,但出现了一些错误: noob:/Users/noob/proj/js/graphiql$ npm run build > graphiql@0.4.5 build /Users/noob/proj/js/graphiql > . ./resources/build.sh ReferenceError: [BABEL] src/codemirror/lint/json-lint.js: Un
npm运行构建
,但出现了一些错误:
noob:/Users/noob/proj/js/graphiql$ npm run build
> graphiql@0.4.5 build /Users/noob/proj/js/graphiql
> . ./resources/build.sh
ReferenceError: [BABEL] src/codemirror/lint/json-lint.js: Unknown option: /Users/noob/proj/js/graphiql/package.json.optional
at Logger.error (/usr/local/lib/node_modules/babel-cli/node_modules/babel-core/lib/transformation/file/logger.js:41:11)
at OptionManager.mergeOptions (/usr/local/lib/node_modules/babel-cli/node_modules/babel-core/lib/transformation/file/options/option-manager.js:262:18)
at OptionManager.addConfig (/usr/local/lib/node_modules/babel-cli/node_modules/babel-core/lib/transformation/file/options/option-manager.js:221:10)
at OptionManager.findConfigs (/usr/local/lib/node_modules/babel-cli/node_modules/babel-core/lib/transformation/file/options/option-manager.js:370:30)
at OptionManager.init (/usr/local/lib/node_modules/babel-cli/node_modules/babel-core/lib/transformation/file/options/option-manager.js:412:12)
at File.initOptions (/usr/local/lib/node_modules/babel-cli/node_modules/babel-core/lib/transformation/file/index.js:191:75)
at new File (/usr/local/lib/node_modules/babel-cli/node_modules/babel-core/lib/transformation/file/index.js:122:22)
at Pipeline.transform (/usr/local/lib/node_modules/babel-cli/node_modules/babel-core/lib/transformation/pipeline.js:42:16)
at transform (/usr/local/lib/node_modules/babel-cli/lib/babel/util.js:53:22)
at Object.compile (/usr/local/lib/node_modules/babel-cli/lib/babel/util.js:62:12)
npm ERR! Darwin 14.5.0
npm ERR! argv "node" "/usr/local/bin/npm" "run" "build"
npm ERR! node v0.12.7
npm ERR! npm v2.14.4
npm ERR! code ELIFECYCLE
npm ERR! graphiql@0.4.5 build: `. ./resources/build.sh`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the graphiql@0.4.5 build script '. ./resources/build.sh'.
npm ERR! This is most likely a problem with the graphiql package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! . ./resources/build.sh
npm ERR! You can get their info via:
npm ERR! npm owner ls graphiql
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/noob/proj/js/graphiql/npm-debug.lognoob
这是日志文件:
0 info it worked if it ends with ok
1 verbose cli [ 'node', '/usr/local/bin/npm', 'run', 'build' ]
2 info using npm@2.14.4
3 info using node@v0.12.7
4 verbose node symlink /usr/local/bin/node
5 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
6 info prebuild graphiql@0.4.5
7 info build graphiql@0.4.5
8 verbose unsafe-perm in lifecycle true
9 info graphiql@0.4.5 Failed to exec build script
10 verbose stack Error: graphiql@0.4.5 build: `. ./resources/build.sh`
10 verbose stack Exit status 1
10 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:214:16)
10 verbose stack at EventEmitter.emit (events.js:110:17)
10 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:24:14)
10 verbose stack at ChildProcess.emit (events.js:110:17)
10 verbose stack at maybeClose (child_process.js:1015:16)
10 verbose stack at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
11 verbose pkgid graphiql@0.4.5
12 verbose cwd /Users/noob/proj/js/graphiql
13 error Darwin 14.5.0
14 error argv "node" "/usr/local/bin/npm" "run" "build"
15 error node v0.12.7
16 error npm v2.14.4
17 error code ELIFECYCLE
18 error graphiql@0.4.5 build: `. ./resources/build.sh`
18 error Exit status 1
19 error Failed at the graphiql@0.4.5 build script '. ./resources/build.sh'.
19 error This is most likely a problem with the graphiql package,
19 error not with npm itself.
19 error Tell the author that this fails on your system:
19 error . ./resources/build.sh
19 error You can get their info via:
19 error npm owner ls graphiql
19 error There is likely additional logging output above.
20 verbose exit [ 1, true ]
0信息如果它以ok结尾,它就工作了
1详细cli['node','/usr/local/bin/npm','run','build']
2信息使用npm@2.14.4
3信息使用node@v0.12.7
4详细节点符号链接/usr/local/bin/node
5详细运行脚本['prebuild','build','postbuild']
6信息预构建graphiql@0.4.5
7信息构建graphiql@0.4.5
8生命周期中的详细不安全perm true
9信息graphiql@0.4.5无法执行生成脚本
10详细堆栈错误:graphiql@0.4.5构建:`/参考资料/build.sh`
10详细堆栈退出状态1
EventEmitter上的10个详细堆栈。(/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:214:16)
EventEmitter.emit上的10个详细堆栈(events.js:110:17)
10子进程上的详细堆栈。(/usr/local/lib/node_modules/npm/lib/utils/spawn.js:24:14)
ChildProcess.emit上的10个详细堆栈(events.js:110:17)
10 maybeClose的详细堆栈(child_process.js:1015:16)
10 Process.ChildProcess.\u handle.onexit处的详细堆栈(child\u Process.js:1087:5)
11详细的pkgidgraphiql@0.4.5
12详细的cwd/Users/noob/proj/js/graphiql
13.14.5.0
14错误argv“node”“/usr/local/bin/npm”“run”“build”
15错误节点v0.12.7
16错误npm v2.14.4
17错误代码ELIFECYCLE
18错误graphiql@0.4.5构建:`/参考资料/build.sh`
18错误退出状态1
19错误发生在graphiql@0.4.5生成脚本“/参考资料/build.sh'。
19错误这很可能是graphiql包的问题,
19错误与npm本身无关。
19错误告诉作者此操作在您的系统上失败:
19错误/参考资料/build.sh
19错误您可以通过以下方式获取他们的信息:
19错误npm所有者ls graphiql
19错误上面可能有额外的日志输出。
20详细退出[1,正确]
有人是如何调试这些东西的?我从哪里开始?
提前谢谢
更新:
如果我在目录graphiql/src/codemirror/lint
中的文件json lint.js
上运行babel
,我会得到相同的错误:
babel json lint.js
几乎可以肯定,该版本的babel已经删除了可选的
选项。因为错误来自/usr/local/lib/node_modules
,这表明构建是针对全局安装的Babel版本运行的,而不是由graphiql
的package.json
指定的版本
我的猜测是,您还没有安装巴贝尔的项目本地版本,因此构建脚本正在退回到全局版本。在运行
npm run build
之前,请尝试运行npm install
,以确保不再发生这种情况。